loadBuffer method Null safety
- String key
override
Retrieve a binary resource from the asset bundle as an immutable buffer.
Throws an exception if the asset is not found.
Implementation
@override
Future<ui.ImmutableBuffer> loadBuffer(String key) async {
if (kIsWeb) {
final ByteData bytes = await load(key);
return ui.ImmutableBuffer.fromUint8List(bytes.buffer.asUint8List());
}
try {
return await ui.ImmutableBuffer.fromAsset(key);
} on Exception {
throw FlutterError('Unable to load asset: $key.');
}
}