chunkById method
Implementation
@override
Future<void> chunkById(
int chunk,
void Function(List<Map<String, dynamic>> data) callback, [
String column = 'id',
]) async {
try {
int lastId = 0;
while (true) {
whereGreaterThan(column, lastId).orderByAsc(column).limit(chunk);
final result = await get();
if (result.isEmpty) {
break;
}
callback(result);
lastId = int.parse(result.last[column].toString());
if (result.length < chunk) {
break;
}
}
} catch (e) {
rethrow;
}
}