EnvironmentControl<T> class abstract

Provides a widget that allows interaction with an EnvironmentState-backed variable.

Implementers

Constructors

EnvironmentControl({required String title, required String stateKey, required T defaultValue, void onValueUpdated(T)?, EnvironmentState? environmentState})
Provides a widget that allows interaction with an EnvironmentState-backed variable.

Properties

currentValue → T
The value of the environment variable keyed by stateKey.
no setter
defaultValue → T
The starting value associated with stateKey. The EnvironmentState value associated with stateKey will be reset to this value when EnvironmentState.reset is executed.
final
hashCode int
The hash code for this object.
no setterinherited
onValueUpdated → void Function(T)?
An optional callback to perform custom logic when the value backing this control is updated.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateKey String
The key used to store the associated value in EnvironmentState. The same key can be used by multiple EnvironmentControls to manipulate the same value.
final
title String
The name of this control.
final

Methods

build(BuildContext context) Widget
Invokes builder with the current value keyed by stateKey and a callback to update that value.
builder(BuildContext context, T? currentValue, void updateValue(T)) Widget
Builds a widget that presents and manipulates the value of the environment variable keyed by stateKey.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateValue(T newValue) → void
A convenience function to update the value keyed by stateKey in _environmentState.

Operators

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