LocationConverter class

Handles the conversion of UI states into and from url locations.

The class provides the methods locationOfState and stateOfLocation to handle the conversion of states and location strings. Therefore a set of states must be provided, which is then searched for the conversion from url locations. The default conversion behavior matches url locations by the exact state names.

So if the state child would be selected in this example

GroupState(
  id: 'group',
  innerStates: [UIState(id: 'child')],
)

the location is mapped to /child. By setting the parameter useFullLocations to true, the parent state names are included in the resulting url. So the result for the previous example would be /group/child.

Constructors

LocationConverter({required Set<UIState> states, bool useFullLocations = false})
Creates an instance of LocationConverter.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
states Set<UIState>
Is searched for corresponding states to available locations.
final
useFullLocations bool
Controls whether parent locationsshould be included.
final

Methods

locationOfState(UIState state) String
Converts the provided state to a url location.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stateOfLocation(String? path) UIState?
Searches the corresponding state object to the provided path.
toString() String
A string representation of this object.
inherited

Operators

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