ModifiableSnapshotView class

Base class for data classes that can be changed

Example use:

mixin AddressMixin {

  String get city => get('city');

  set city(String v) => set('city',v);
}

class Address = ModifiableSnapshotView with AddressMixin;

This will create an Address class containing the getters and setters (and possibly other methods) defined in AddressMixin and with a fromJson constructor and toJson method.

ModifiableSnapshotViews should be used with care as changes will not flow upstream. For example, consider the following code:

var snapshot = ModifiableSnapshotView.fromJson({
  'firstname': 'John',
  'address': {
    'addressLine1': 'Mainstreet 1',
    'city': 'London'
  }
});
var address = snapshot.get<Address>('address');
address.city = 'New York';
print(snapshot.get('address/city')); // prints 'London'
print(snapshot.get<Address>('address').city); // prints 'New York'
Mixed-in types
Available extensions

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasValue → bool

Available on ModifiableSnapshotView, provided by the ModifiableSnapshotViewX extension

no setter
isDisposed → bool
no setter
onChanged → Stream<SnapshotViewChangeEvent>

Available on ModifiableSnapshotView, provided by the ModifiableSnapshotViewX extension

no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
snapshot → Snapshot

Available on SnapshotView, provided by the SnapshotViewExtension extension

no setter

Methods

dispose() → Future<void>
get<T>(String path, {String? format}) → T

Available on SnapshotView, provided by the SnapshotViewExtension extension

Gets and converts the value at path to type T
getList<T>(String path, {String? format}) → List<T>?

Available on SnapshotView, provided by the SnapshotViewExtension extension

Gets and converts the value at path to type List
getMap<T>(String path, {String? format}) → Map<String, T>?

Available on SnapshotView, provided by the SnapshotViewExtension extension

Gets and converts the value at path to type Map<String,T> or null
getNonNullableList<T>(String path, {String? format}) → List<T>

Available on SnapshotView, provided by the SnapshotViewExtension extension

Gets and converts the value at path to type List
getNonNullableMap<T>(String path, {String? format}) → Map<String, T>

Available on SnapshotView, provided by the SnapshotViewExtension extension

Gets and converts the value at path to type Map<String,T>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(String? path, dynamic value) → void

Available on ModifiableSnapshotView, provided by the ModifiableSnapshotViewX extension

Updates the content at path with value
toJson() → dynamic
Returns the JSON representation of the snapshot
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited