Snapshot class abstract

A Snapshot holds immutable data that represents part of the content of a (remote) database at some moment.

It typically contains JSON-like data received through a network connection. The content can however also be easily converted to other data types, like DateTime or Uri. The instance method Snapshot.as makes this conversion and caches the result, so that subsequent calls with the same type parameter do not invoke a new conversion.

Annotations
  • @immutable

Constructors

Snapshot.empty({SnapshotDecoder? decoder})
Creates an empty snapshot with the specified decoder
factory
Snapshot.fromJson(dynamic content, {SnapshotDecoder? decoder})
Creates a snapshot from the JSON-like content
factory

Properties

decoder SnapshotDecoder
The decoder that will be used to decode content
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → dynamic
The raw content of this snapshot
no setter

Methods

as<T>({String? format}) → T
Returns the content of this snapshot as an object of type T.
asList<T>({String? format}) List<T>?
Returns the content of this snapshot as a nullable list of objects of type T.
asMap<T>({String? format}) Map<String, T>?
Returns the content of this snapshot as a nullable map with value objects of type T.
asNonNullableList<T>({String? format}) List<T>
Returns the content of this snapshot as a non-nullable list of objects of type T.
asNonNullableMap<T>({String? format}) Map<String, T>
Returns the content of this snapshot as a non-nullable map with value objects of type T.
child(String path) Snapshot
The Snapshot that represents a (grand)child of this Snapshot.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(dynamic value) Snapshot
Returns a snapshot with updated content.
setPath(String path, dynamic value, {bool createParents = true}) Snapshot
Returns a snapshot with updated content at path.
toString() String
A string representation of this object.
override
withDecoder(SnapshotDecoder decoder) Snapshot
Returns a snapshot with another decoder.

Operators

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