load method

  1. @override
Future<ByteData> load (String key)
override

Retrieve a binary resource from the asset bundle as a data stream.

Throws an exception if the asset is not found.

Implementation

@override
Future<ByteData> load(String key) async {
  final Uint8List encoded = utf8.encoder.convert(Uri(path: Uri.encodeFull(key)).path);
  final ByteData asset =
      await BinaryMessages.send('flutter/assets', encoded.buffer.asByteData());
  if (asset == null)
    throw FlutterError('Unable to load asset: $key');
  return asset;
}