Change class
A representation of a single change in a scalar value.
class Change { dynamic oldValue; dynamic newValue; get isEmpty { return oldValue == unset && newValue == unset; } /** * Creates new [Change] from information about the value before change * [oldValue] and after the change [newValue]. */ Change([this.oldValue = unset, this.newValue = unset]){ assert(oldValue is! DataReference); assert(newValue is! DataReference); } bool equals(dynamic other) { if (other is Change){ return oldValue == other.oldValue && newValue == other.newValue; } else { return false; } } /** * Applies another [change] to get representation of whole change. */ void mergeIn(Change change) { if (change.isEmpty) { return; } assert(isEmpty || change.oldValue == this.newValue); if (isEmpty) { oldValue = change.oldValue; } newValue = change.newValue; } /** * Clones the [change]. */ Change clone() { return new Change(oldValue, newValue); } String toString() => "Change($oldValue->$newValue)"; }
Constructors
Properties
final isEmpty #
get isEmpty { return oldValue == unset && newValue == unset; }
var newValue #
dynamic newValue
var oldValue #
dynamic oldValue
Methods
bool equals(other) #
bool equals(dynamic other) { if (other is Change){ return oldValue == other.oldValue && newValue == other.newValue; } else { return false; } }