ChangeDetail<T extends DocumentSerializable> class

Comprehensive record of a change event for a specific database entity.

This immutable class encapsulates all information about a modification to a single object, including metadata, field-level changes, and optionally the complete document state after the change.

The generic parameter T is constrained to types that can be serialized, ensuring type safety for the full document representation.

Annotations
  • @immutable

Constructors

ChangeDetail.new({required String collectionName, required int objectId, required String key, required ChangeType changeType, required List<FieldChange<DocumentSerializable>> fieldChanges, required T fullDocument, DateTime? timestamp})
Creates a change detail record.
const
ChangeDetail.fromJson(Map<String, dynamic> json, {T documentParser(Map<String, dynamic>)?})
Deserializes a ChangeDetail from JSON with robust error handling.
factory

Properties

changeType ChangeType
The type of database operation that was performed.
final
collectionName String
The name of the collection where this change occurred.
final
fieldChanges List<FieldChange<DocumentSerializable>>
Individual field-level changes within this object.
final
fullDocument → T
The complete document state after the change was applied.
final
hasFieldChanges bool
Indicates whether this change has any actual field modifications.
no setter
hashCode int
The hash code for this object.
no setteroverride
key String
Unique identifier for this data object, typically the primary key.
final
modifiedFields Set<String>
Gets the field names that were modified in this change.
no setter
objectId int
The unique identifier of the changed object within its collection.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
significantChanges List<FieldChange<DocumentSerializable>>
Returns only the field changes that represent actual value modifications.
no setter
timestamp DateTime?
When this change was recorded.
final

Methods

copyWith({String? collectionName, int? objectId, String? key, ChangeType? changeType, DateTime? timestamp, T? fullDocument, List<FieldChange<DocumentSerializable>>? fieldChanges}) ChangeDetail<T>
Creates a copy with modified fields.
getFieldChange(String fieldName) → FieldChange<DocumentSerializable>?
Gets the field change for a specific field, if it exists.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this change detail to JSON.
toString() String
Provides detailed string representation for debugging and logging.
override
wasFieldModified(String fieldName) bool
Checks if a specific field was modified in this change.

Operators

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