MapChangeRecord class
class MapChangeRecord extends ChangeRecord { /** The map key that changed. */ final key; // TODO(jmesserly): we could store this more compactly if it matters. /** True if this key was inserted. */ final bool isInsert; /** True if this key was removed. */ final bool isRemove; MapChangeRecord(this.key, {this.isInsert: false, this.isRemove: false}) { if (isInsert && isRemove) { throw new ArgumentError( '$key cannot be inserted and removed in the same change'); } } // Use == on the key, to match equality semantics of most Maps. bool changes(otherKey) => key == otherKey; String toString() { var kind = isInsert ? 'insert' : isRemove ? 'remove' : 'set'; return '#<MapChangeRecord $kind $key>'; } }
Extends
ChangeRecord > MapChangeRecord
Constructors
new MapChangeRecord(key, {bool isInsert: false, bool isRemove: false}) #
MapChangeRecord(this.key, {this.isInsert: false, this.isRemove: false}) { if (isInsert && isRemove) { throw new ArgumentError( '$key cannot be inserted and removed in the same change'); } }
Properties
final bool isInsert #
True if this key was inserted.
final bool isInsert
final bool isRemove #
True if this key was removed.
final bool isRemove
final key #
The map key that changed.
final key
Methods
abstract bool change(key) #
inherited from ChangeRecord
True if the change affected the given item, otherwise false.
bool changes(otherKey) #
bool changes(otherKey) => key == otherKey;
String toString() #
Returns a string representation of this object.
docs inherited from Object
String toString() { var kind = isInsert ? 'insert' : isRemove ? 'remove' : 'set'; return '#<MapChangeRecord $kind $key>'; }