queryIterate method

Future<void> queryIterate(
  1. String table, {
  2. bool? distinct,
  3. List<String>? columns,
  4. String? where,
  5. List<Object?>? whereArgs,
  6. String? groupBy,
  7. String? having,
  8. String? orderBy,
  9. int? limit,
  10. int? offset,
  11. int? bufferSize,
  12. required SqfliteCursorRowCallback onRow,
})

Iterate over the results of a query.

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

Implementation

Future<void> queryIterate(
  String table, {
  bool? distinct,
  List<String>? columns,
  String? where,
  List<Object?>? whereArgs,
  String? groupBy,
  String? having,
  String? orderBy,
  int? limit,
  int? offset,
  int? bufferSize,
  required SqfliteCursorRowCallback onRow,
}) async {
  final cursor = await queryCursor(
    table,
    distinct: distinct,
    columns: columns,
    where: where,
    whereArgs: whereArgs,
    groupBy: groupBy,
    having: having,
    orderBy: orderBy,
    limit: limit,
    offset: offset,
    bufferSize: bufferSize,
  );
  try {
    while (await cursor.moveNext()) {
      if (!(await onRow(cursor.current))) {
        break;
      }
    }
  } finally {
    await cursor.close();
  }
}