@@ -109,7 +109,7 @@ class SkiaFontCollection {
109109 }
110110
111111 final List <dynamic >? fontManifest =
112- json.decode (utf8.decode (byteData.buffer.asUint8List ()));
112+ json.decode (utf8.decode (byteData.buffer.asUint8List ())) as List < dynamic > ? ;
113113 if (fontManifest == null ) {
114114 throw AssertionError (
115115 'There was a problem trying to load FontManifest.json' );
@@ -119,16 +119,16 @@ class SkiaFontCollection {
119119
120120 for (final Map <String , dynamic > fontFamily
121121 in fontManifest.cast <Map <String , dynamic >>()) {
122- final String family = fontFamily[ 'family' ] ! ;
123- final List <dynamic > fontAssets = fontFamily[ 'fonts' ] ;
122+ final String family = fontFamily. readString ( 'family' ) ;
123+ final List <dynamic > fontAssets = fontFamily. readList ( 'fonts' ) ;
124124
125125 if (family == 'Roboto' ) {
126126 registeredRoboto = true ;
127127 }
128128
129129 for (final dynamic fontAssetItem in fontAssets) {
130- final Map <String , dynamic > fontAsset = fontAssetItem;
131- final String asset = fontAsset[ 'asset' ] ;
130+ final Map <String , dynamic > fontAsset = fontAssetItem as Map < String , dynamic > ;
131+ final String asset = fontAsset. readString ( 'asset' ) ;
132132 _unloadedFonts
133133 .add (_registerFont (assetManager.getAssetUrl (asset), family));
134134 }
@@ -151,7 +151,7 @@ class SkiaFontCollection {
151151 Future <RegisteredFont ?> _registerFont (String url, String family) async {
152152 ByteBuffer buffer;
153153 try {
154- buffer = await html.window. fetch (url).then (_getArrayBuffer);
154+ buffer = await httpFetch (url).then (_getArrayBuffer);
155155 } catch (e) {
156156 printWarning ('Failed to load font $family at $url ' );
157157 printWarning (e.toString ());
@@ -178,8 +178,7 @@ class SkiaFontCollection {
178178 return actualFamily;
179179 }
180180
181- Future <ByteBuffer > _getArrayBuffer (dynamic fetchResult) {
182- // TODO(yjbanov): fetchResult.arrayBuffer is a dynamic invocation. Clean it up.
181+ Future <ByteBuffer > _getArrayBuffer (html.Body fetchResult) {
183182 return fetchResult
184183 .arrayBuffer ()
185184 .then <ByteBuffer >((dynamic x) => x as ByteBuffer );
0 commit comments