update method
Updates existing records in the database table.
data: A map containing the column names and new values.
where: A SQL WHERE clause to specify which records to update.
whereArgs: Arguments for the WHERE clause.
Returns a Future that completes when the operation is done. Throws an error if the update fails.
Implementation
Future<void> update(Map<String, Object?> data, String? where, List<Object?>? whereArgs) async {
try {
final db = await database;
await db.update(_helper.tableName, data, where: where, whereArgs: whereArgs);
} catch (e) {
return Future.error("Error in updating the data: $e");
}
}