Substitution<V extends ValueRef> class abstract final

Causes the static Ref methods to reference a different Get object.

{@tool snippet}

A substitution is made by wrapping a Get object in a Ref constructor and calling a Ref instance method, such as Ref.subGet.

GetScope(
  substitutes: {Ref(getValue).sub(getOtherValue)},
  child: widget.child,
);

{@end-tool}

See also: useSubstitute, to create a substitution via a Hook function.

Mixed-in types

Properties

autoDispose bool
Whether to automatically call ChangeNotifier.dispose when the substitution is no longer part of an active GetScope.
final
hashCode int
The hash code for this object.
no setterinherited
ref → V
The original ValueListenable object (i.e. the listenable encapsulated in a Get object).
final
replacement → V
A ValueListenable of the same type as the ref which will be referenced in its place by methods like Ref.watch called from descendant widgets.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

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