cursor method

  1. @override
Stream<Map<String, dynamic>> cursor([
  1. int chunk = 1000
])
inherited

Implementation

@override
Stream<Map<String, dynamic>> cursor([
  int chunk = 1000,
]) async* {
  try {
    int offset = 0;

    while (true) {
      limit(chunk).offset(offset);

      final result = await get();
      if (result.isEmpty) {
        break;
      }

      for (final row in result) {
        yield row;
      }

      offset += chunk;

      if (result.length < chunk) {
        break;
      }
    }
  } catch (e) {
    rethrow;
  }
}