commitRange method

Future<List<List<Object?>>> commitRange(
  1. int start,
  2. int end
)

Commits this batch and applies it for a range of cursor rows.

Valid range is from 0 to the cursor getCount.

The end is not strict - if getCount is than the end, the returned list will just be shorter by their difference.

Only one commit or commitRange operation can run at once, other calls won't start before the ongoing commit ends.

This function does not affect the cursor position.

Implementation

Future<List<List<Object?>>> commitRange(int start, int end) async {
  assert(!_cursor._closed);
  assert(start >= 0);
  assert(start <= end);
  if (start == end) {
    return [];
  }
  final result = await _cursor._methodChannel
      .invokeListMethod<List<Object?>>('commitRangeGetBatch', {
    'operations': _operations,
    'start': start,
    'end': end,
  });
  for (int i = 0; i < result!.length; i++) {
    final row = result[i].cast<Object?>();
    result[i] = row;
    _correctResult(row);
  }
  return result.cast<List<Object?>>();
}