toRowList method

Future<List<CursorRow>> toRowList({
  1. int? limit,
  2. int? offset,
  3. IdbCursorWithValueMatcherFunction? matcher,
})

Convert an openCursor stream to a list.

Implementation

Future<List<CursorRow>> toRowList({
  int? limit,
  int? offset,
  IdbCursorWithValueMatcherFunction? matcher,
}) {
  CursorRow? getRow(CursorWithValue cwv) {
    if (matcher != null && !matcher(cwv)) {
      return null;
    }
    var value = cloneValue(cwv.value);
    return CursorRow(cwv.key, cwv.primaryKey, value);
  }

  return _cursorStreamToList(
    this,
    (cwv) => getRow(cwv),
    offset: offset,
    limit: limit,
  );
}