readBinaryFile method

Future<Uint8List> readBinaryFile(
  1. String fileName
)

Reads a binary file from assets folder.

Implementation

Future<Uint8List> readBinaryFile(String fileName) async {
  if (!_files.containsKey(fileName)) {
    _files[fileName] = await _readBinary(fileName);
  }
  assert(
    _files[fileName] is _BinaryAsset,
    '"$fileName" was previously loaded as a text file',
  );
  return (_files[fileName]! as _BinaryAsset).value;
}