update method

Future<int> update(
  1. int id
)

Update an existing record

Implementation

Future<int> update(int id) async {
  try {
    final db = await database;
    final data = toMap();
    data.putIfAbsent("updated_at", () => DateTime.now());

    return await db.update(
      table,
      _handleDataType(data),
      where: 'id = ?',
      whereArgs: [id],
    );
  } catch (e) {
    throw DatabaseException('Failed to update record with ID $id: $e');
  }
}