syncOriginal method

void syncOriginal()
inherited

Syncs the current attributes as the "original" state for change tracking.

After calling this, isDirty will return false until attributes are modified. This is typically called automatically when a model is loaded from the database.

Example:

final user = await Users.query().where('id', 1).first();
user.setAttribute('name', 'Changed');
print(user.isDirty()); // true
user.syncOriginal();
print(user.isDirty()); // false

Implementation

void syncOriginal() {
  _originalAttributes[this] = Map<String, Object?>.from(_ensureAttributes());
}