FieldChange<T extends DocumentSerializable> class

Immutable representation of a field-level change.

Captures the modification of a single field, preserving both the previous state and the new state. Values are kept as dynamic to accommodate the varying data types found in document databases.

The class implements value equality and provides comprehensive debugging information.

Annotations
  • @immutable

Constructors

FieldChange.new({required String fieldName, Object? oldValue, Object? newValue})
Creates a field change record.
const
FieldChange.fromJson(Map<String, dynamic> json, {T documentParser(Map<String, dynamic>)?})
Deserializes a FieldChange from JSON with validation.
factory

Properties

fieldName String
The identifier of the field that was modified.
final
hasActualChange bool
Determines if the old and new values are effectively the same.
no setter
hashCode int
The hash code for this object.
no setteroverride
isCreation bool
Determines if this represents a field creation (insert scenario).
no setter
isDeletion bool
Determines if this represents a field deletion (delete scenario).
no setter
isModification bool
Determines if this represents a field modification (update scenario).
no setter
newValue Object?
The value after the change was applied.
final
oldValue Object?
The value before the change occurred.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this field change to JSON.
toString() String
Provides a comprehensive string representation for debugging.
override

Operators

operator ==(Object other) bool
The equality operator.
override