newReg method
- @Deprecated('This method is deprecated and will be deleted on the next release. Please use `insertSingle` or `batchInsert` instead.')
- dynamic newReg
This function takes a record newReg and inserts it into the corresponding table.
The method newReg is asynchronous and returns a Future<int>. It accepts a dynamic object newReg as an argument.
It first gets a reference to the database using DBProvider.db.database.
Then, it inserts newReg into the table corresponding to its runtime type, converting newReg to JSON format for insertion.
The method returns the result of the insertion operation as an integer.
Implementation
@Deprecated(
'This method is deprecated and will be deleted on the next release. Please use `insertSingle` or `batchInsert` instead.')
Future<int> newReg(dynamic newReg) async {
final db = await DBProvider.db.database;
int res = 0;
res = await db!.insert('${newReg.runtimeType}', newReg.toJson());
PrintHandler.warningLogger.i(
'sqflite_simple_dao_backend: You just insert $res items to ${newReg.runtimeType}.✨');
return res;
}