loadFileAsBytes method

Future<Uint8List> loadFileAsBytes(
  1. String fileAssetLocation
)

Loads a file from project assets as Uint8List bytes.

fileAssetLocation specifies the path of asset at project level. For example: If file is located at

Implementation

Future<Uint8List> loadFileAsBytes(String fileAssetLocation) async {
  final rawAssetFile = await rootBundle.load('$fileAssetLocation');
  final rawBytes = rawAssetFile.buffer.asUint8List();
  return rawBytes;
}