readAsBytes_ method

FutureOr<Uint8List?> readAsBytes_()

Reads the contents of the File as Uint8List. Returns null if the File does not exist.

Implementation

FutureOr<Uint8List?> readAsBytes_() async {
  _locks[addPrefix(path)] ??= Lock();
  return _locks[addPrefix(path)]?.synchronized(() async {
    final file = File(addPrefix(path));
    if (await file.exists_()) {
      return await file.readAsBytes();
    }
    return null;
  });
}