getUint8List function

Future<Uint8List> getUint8List(
  1. String filepath
)

Returns the Future of the file at the given filepath path.

Example: getUint8List('assets/file.jpg')

Implementation

Future<Uint8List> getUint8List(String filepath) async {
  final data = await PlatformAssetBundle().load(filepath);
  final bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
  return bytes;
}