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.

Implementation

Future<Uint8List?> readFileAsBytes({String? fileName, String? path}) async {
  final String resolved = await _resolvePath(fileName, path);
  final File file = File(resolved);
  if (!file.existsSync()) return null;
  return file.readAsBytesSync();
}