rawQueryIterate method

Future<void> rawQueryIterate(
  1. String sql,
  2. List<Object?>? arguments, {
  3. int? bufferSize,
  4. required SqfliteCursorRowCallback onRow,
})

Iterate over the results of a raw query.

onRow is called for each row. Return false to stop the iteration.

Implementation

Future<void> rawQueryIterate(
  String sql,
  List<Object?>? arguments, {
  int? bufferSize,
  required SqfliteCursorRowCallback onRow,
}) async {
  final cursor = await rawQueryCursor(sql, arguments, bufferSize: bufferSize);
  try {
    while (await cursor.moveNext()) {
      if (!(await onRow(cursor.current))) {
        break;
      }
    }
  } finally {
    await cursor.close();
  }
}