insert method
Future<TEntity?>
insert(
- TEntity item, {
- bool? useIsolate,
})
inherited
Implementation
@override
Future<TEntity?> insert(
TEntity item, {
final bool? useIsolate,
}) async {
final db = await dbContext.database;
final spawnIsolate = useIsolate ?? useIsolateDefault;
final response = !spawnIsolate
? wInsertOrUpdate(item)
: await compute(wInsertOrUpdate, item);
final updated = await db.insert(
response.entity.meta.tableName, response.map,
conflictAlgorithm: ConflictAlgorithm.abort);
return updated > 0 ? response.entity as TEntity? : null;
}