readFileAsBytes method

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

Reads the file and returns its raw bytes. Returns null when the file does not exist.

An encrypted file is decrypted (the key must be in use).

Implementation

Future<Uint8List?> readFileAsBytes({String? fileName, String? path}) async {
  final Uint8List? bytes = await _store.read(
    fileName: fileName,
    path: validatePath(path),
  );
  if (bytes == null || !isEncryptedFile(bytes)) return bytes;
  return _open(bytes);
}