resolveAs<T> static method
- T value,
- Set<
WidgetState> states
Resolves the value for the given set of states if value
is a
WidgetStateProperty, otherwise returns the value itself.
This is useful for widgets that have parameters which can optionally be a WidgetStateProperty. For example, InkWell.mouseCursor can be a MouseCursor or a WidgetStateProperty<MouseCursor>.
Implementation
static T resolveAs<T>(T value, Set<WidgetState> states) {
if (value is WidgetStateProperty<T>) {
final WidgetStateProperty<T> property = value;
return property.resolve(states);
}
return value;
}