FWidgetStateMap<T> class

A WidgetStateProperty that resolves to a T using a WidgetStateMap.

Constraints are checked in the order they are provided. The first constraint that is satisfied will have its associated value returned.

Example

final property = FWidgetStateMap<Color>({
  WidgetState.pressed: Colors.blue,
  WidgetState.hovered: Colors.green,
});

final color = property.resolve({WidgetState.pressed, WidgetState.hovered});
print(color); // Colors.blue
Implemented types

Constructors

FWidgetStateMap.new(WidgetStateMap<T> _constraints)
Creates a FWidgetStateMap with the given constraints.
const
FWidgetStateMap.all(T value)
Creates a FWidgetStateMap which always resolves to the given value.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<R>(R map(T)) FWidgetStateMap<R>
Returns a new FWidgetStateMap with the same constraints, but with different values produced by map.
maybeResolve(Set<WidgetState> states) → T?
Returns a value that depends on states by checking the constraints given in FWidgetStateMap.new, or null if no T is found.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replaceAllWhere(Set<WidgetState> states, T replace(T)) FWidgetStateMap<T>
Creates a new FWidgetStateMap where all values associated with constraints satisfied by states are replaced with the result of calling replace on the original value.
replaceFirstWhere(Set<WidgetState> states, T replace(T)) FWidgetStateMap<T>
Creates a new FWidgetStateMap where only the first value associated with a constraint satisfied by states is replaced with the result of calling replace on the original value.
replaceLastWhere(Set<WidgetState> states, T replace(T)) FWidgetStateMap<T>
Creates a new FWidgetStateMap where only the last value associated with a constraint satisfied by states is replaced with the result of calling replace on the original value.
resolve(Set<WidgetState> states) → T
Returns a value that depends on states by checking the constraints given in FWidgetStateMap.new.
override
toString() String
A string representation of this object.
inherited

Operators

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