cursorToList function

Future<List<CursorRow>> cursorToList(
  1. Stream<CursorWithValue> stream, [
  2. int? offset,
  3. int? limit,
  4. IdbCursorWithValueMatcherFunction? matcher,
])

Convert an autoAdvance openCursor stream to a list

Implementation

Future<List<CursorRow>> cursorToList(
  Stream<CursorWithValue> stream, [
  int? offset,
  int? limit,
  IdbCursorWithValueMatcherFunction? matcher,
]) {
  CursorRow? getRow(CursorWithValue cwv) {
    if (matcher != null) {
      if (!matcher(cwv)) {
        return null;
      }
    }
    final row = CursorRow(cwv.key, cwv.primaryKey, cloneValue(cwv.value));
    return row;
  }

  return _autoCursorStreamToList(stream, (cwv) => getRow(cwv), offset, limit);
}