increment method

Future<void> increment(
  1. String column, [
  2. int amount = 1
])
inherited

Increment a column's value.

Implementation

Future<void> increment(String column, [int amount = 1]) async {
  if (!exists) return;

  await query.where(primaryKey, '=', getKey()).increment(column, amount);

  if (this is HasAttributes) {
    final current = (this as HasAttributes).getAttribute(column);
    if (current is num) {
      (this as HasAttributes).setAttribute(column, current + amount);
      (this as HasAttributes).syncOriginal();
    }
  }
}