TestSnapshots class final

The snapshot parts a world would capture, held in memory: what host.registry<SnapshotRegistry>() answers in a PluginTestHost.

capture answers one map, part id to {'version': n, 'data': …}, which restore takes back, parts marked restoresFirst first. It refuses what the engine's Snapshots refuses: an id taken (NameTakenException), an id outside the plugin's namespace through its view (PluginException), a state written at a newer part version than the part reads, and a state holding none of the parts (StateError). It digests what capture writes, which is enough to tell two states apart in a test and is not the engine's digest.

Inheritance

Constructors

TestSnapshots()
An empty registry.

Properties

companions → Iterable<PluginRegistry>
The registries that come with this one, found by PluginHost.registry as if each had been handed to the host itself.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
parts → List<String>
The ids of the parts, in the order they are captured and restored.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(SnapshotPart part) → Registration
Adds part. Throws a NameTakenException when its id is taken.
override
capture() → Map<String, Object?>
Every part's state, in registration order, as one value restore takes back: flutter3d_sim's Snapshot, whose data holds plain values only.
override
digest() → int
A number that differs when any part's state does.
override
forPlugin(PluginScope scope) → SnapshotRegistry
This registry as scope's plugin sees it: everything registered through the result is tracked by scope, ranked by it, and checked against its manifest. Must return the same type the registry is looked up by.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restore(Object state) → void
Puts every part back to what state, a capture of this registry, holds.
override
toString() → String
A string representation of this object.
inherited

Operators

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