update method
Updates an existing item
in the local database.
Returns the updated item.
Implementation
@override
Future<T> update(T item) async {
final now = DateTime.now();
final updatedAt = item.updatedAt ?? now;
final updatedItem = item.copyWith(updatedAt: updatedAt) as T;
await (database).update(
tableName,
updatedItem.toJson(),
where: 'id = ?',
whereArgs: [item.id],
conflictAlgorithm: ConflictAlgorithm.replace,
);
return item;
}