isParentRoute method

bool isParentRoute(
  1. GoRouterState state
)
inherited

Determine if this route is a parent of the current route.

e.g. if this route is '/parent' and the current GoRouter location is '/parent/child', '/parent/child/sub-child', etc, this method will return true.

This is useful for determining if a parent route is active.

Implementation

bool isParentRoute(GoRouterState state) {
  final location = state.fullPath;

  if (location == null || location == _fullPathTemplate) {
    return false;
  }

  return location.startsWith(_fullPathTemplate);
}