readAsBytes method

  1. @override
Future<List<int>> readAsBytes(
  1. AssetId id
)

Returns a Future that completes with the bytes of a binary asset.

  • Throws a PackageNotFoundException if id.package is not found.
  • Throws a AssetNotFoundException if id.path is not found.
  • Throws an InvalidInputException if id is an invalid input.

Implementation

@override
Future<List<int>> readAsBytes(AssetId id) {
  if (!source.assets.containsKey(id)) {
    throw AssetNotFoundException(id);
  }
  return Future.value(source.assets[id]!);
}