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 {
  if (start != null && count == null) {
    throw ArgumentError('`count` must be provided if `start` is provided');
  }
  if (count != null) {
    if (count <= 0) {
      throw ArgumentError('`count` must be greater than 0');
    }
    start ??= 0;
  }
  final res = await methodChannel.invokeMethod<Uint8List>('readFileBytes', {
    'fileUri': uri.toString(),
    'start': start,
    'count': count,
  });
  if (res == null) {
    throw Exception('Unexpected empty response from `readFileBytes`');
  }
  return res;
}