WriggleContext class

Context for component building. Provides state reading/writing.

Constructors

WriggleContext({required void onUpdate(), required AudioAdapter audio, required ClipboardAdapter clipboard, required DialogAdapter dialog, required GamepadAdapter gamepad})
Context for component building. Provides state reading/writing.

Properties

audio AudioAdapter
Audio adapter.
final
clipboard ClipboardAdapter
Clipboard adapter. Use read and write to get and set contents.
final
dialog → DialogAdapter
Dialog adapter. Use push and pop to add and remove dialogs from the stack.
final
gamepad GamepadAdapter
Gamepad adapter. Allows reading of joystick positions.
final
hashCode int
The hash code for this object.
no setterinherited
onUpdate → void Function()
Called when
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearDependencies() → void
Clears all state dependencies.
discardState(StateReference reference) → void
Invalidates the state of the provider, causing it to refresh at the start of the next frame.
ensureStateUpdated() Future<void>
Await to ensure state has been updated for this frame.
invalidate(ProviderOrFamily provider) → void
Invalidates the state of the provider, causing it to refresh at the start of the next frame.
listen<State>(ProviderListenable<State> provider, void listener(State?, State), {bool fireImmediately = false, void onError(Object, StackTrace)?}) → ProviderSubscription<State>
Listen to a provider and call listener whenever its value changes.
listenState<T>(StateReference reference, void listener(T?, T), {bool fireImmediately = false, void onError(Object, StackTrace)?}) → ProviderSubscription<Object?>
Registers a listener for a component state. Returns a subscription that can be used to cancel the listener early.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<Result>(ProviderListenable<Result> provider) → Result
Reads a provider and returns the currently exposed value.
readState<T>(StateReference reference, T startingState) → T
Read the current state of a component. States are separated by component type and key.
recordDependency(StateReference dependent, StateReference parent) → void
Records a state dependency. When parent rebuilds, dependent is invalidated.
toString() String
A string representation of this object.
inherited
writeState<T>(StateReference reference, T value) → void
Write the current state of a component. States are separated by type (T) and key.

Operators

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