getByteList method

Uint8List getByteList(
  1. dynamic file
)

Returns the file as Uint8List of a file.

If the file is already of type Uint8List returns as-is.

Implementation

Uint8List getByteList(dynamic file) {
  if (file is Uint8List) {
    return file;
  }
  if (file is File) {
    return file.readAsBytesSync();
  }
  throw FileTypeError();
}