insertAll method
Future<int>
insertAll(
- List<
T?> t, { - String? tableName,
- String? nullColumnHack,
- ConflictAlgorithm? conflictAlgorithm = ConflictAlgorithm.replace,
override
插入所有model
Implementation
@override
Future<int> insertAll(List<T?> t, {
String? tableName,
String? nullColumnHack,
ConflictAlgorithm? conflictAlgorithm = ConflictAlgorithm.replace,
}) async {
final batch = db.batch();
for (T? c in t) {
if (c == null) continue;
Map<String, dynamic> values = c.toJson();
_convertSafeMap(values);
batch.insert(
tableName ?? table,
values,
nullColumnHack: nullColumnHack,
conflictAlgorithm: conflictAlgorithm,
);
}
await batch.commit(noResult: true);
return Future.value(0);
}