readFileAsBytes method

Future<Uint8List?> readFileAsBytes({
  1. String? fileName,
  2. String? path,
})

if path (entire Lunix or windows path) is provide, fileName must be null

  • returns file as bytes (Uint8List) or null if file do not exists

Implementation

Future<Uint8List?> readFileAsBytes({String? fileName, String? path}) async {
  File file =
      File(validatePath(path) ?? "${await filesPath}$pathJoin$fileName");
  return file.existsSync() ? file.readAsBytesSync() : null;
}