readFileBytes method

  1. @override
Future<Uint8List> readFileBytes(
  1. String uri, {
  2. int? start,
  3. int? count,
})
override

Implementation

@override
Future<Uint8List> readFileBytes(String uri, {int? start, int? count}) async {
  start ??= 0;
  if (start < 0) {
    throw ArgumentError('`start` must be greater than or equal to 0');
  }
  if (count != null) {
    if (count <= 0) {
      throw ArgumentError('`count` must be greater than 0');
    }
  }
  // One-shot read, straight through JNI: skips the MethodChannel codec
  // round trip entirely for what can be a very large byte array.
  return SafStreamJniIo.readFileBytes(
    uri.toString(),
    start: start,
    count: count ?? -1,
  );
}