readFileByte static method
read the byte array of the file with path filePath.
Implementation
static Future<Uint8List> readFileByte(String filePath) async {
AppLogger logger = AppLogger.getInstance();
Uri myUri = Uri.parse(filePath);
File fileHandle = File.fromUri(myUri);
late Uint8List bytes;
await fileHandle.readAsBytes().then((value) {
bytes = Uint8List.fromList(value);
logger.log('reading of bytes is completed');
}).catchError((onError) {
logger.log(
'Exception Error while reading audio from path: ${onError.toString()}',
logLevel: LogLevel.error);
});
return bytes;
}