locationOfState method
Converts the provided state to a url location.
The state name prepended by a single '/' is returned as the location by
default. If useFullLocations is set to true
, the location is build by
prepending the state's name with all parent state names.
Implementation
String locationOfState(UIState state) {
final states = [state];
if (useFullLocations) {
states.insertAll(0, UIStateUtils.parentsOf(state, fromTopmost: true));
}
final path =
states.map((e) => e.id.trim().replaceAll('\s+', '_')).join('/');
return '/$path';
}