getRoute method

Retrieves the current route

If a routeName is not specified, it will use the current route from the navigation stack.

Implementation

BasePageConnector<BasePageState, BasePageView> getRoute(BuildContext context,
    [String? routeName]) {
  routeName ??= this.getRouteName(context) ?? '';
  routeName = routeName.split('?')[0];

  if (routes.containsKey(routeName)) {
    FxLog.v(
        'getRoute(): module->[${this.routeName}].fetchRouteByType(): [$routeName]');
    return _fetchRouteByType(context, routeName);
  } else {
    var parentRouteName = _trimRouteName(routeName);
    if (parentRouteName.isEmpty) {
      FxLog.v(
          'getRoute(): module->[${this.routeName}].fetchRouteByType(): [/]');
      return _fetchRouteByType(context, '/');
    }

    FxLog.v(
        'getRoute(): module->[${this.routeName}].getRoute(): [$parentRouteName]');
    return getRoute(context, parentRouteName);
  }
}