insert method
Future<int>
insert(
- String table,
- JSON values, {
- String? nullColumnHack,
- ConflictAlgorithm? conflictAlgorithm,
override
This method helps insert a map of values
into the specified table
and returns the
id of the last inserted row.
var value = {
'age': 18,
'name': 'value'
};
int id = await db.insert(
'table',
value,
conflictAlgorithm: ConflictAlgorithm.replace,
);
0 could be returned for some specific conflict algorithms if not inserted.
Implementation
@override
Future<int> insert(
String table,
JSON values, {
String? nullColumnHack,
sqlite_api.ConflictAlgorithm? conflictAlgorithm,
}) async {
final id = await _delegate.insert(
table,
values,
nullColumnHack: nullColumnHack,
conflictAlgorithm: conflictAlgorithm,
);
if (id != -1) {
sendTableTrigger({table});
}
return id;
}