queryIterate method
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();
}
}