evaluate method

RouteResult evaluate(
  1. RouteResult parentResult
)

Implementation

RouteResult evaluate(RouteResult parentResult) {
  final evaluation = matcher.evaluate(parentResult.remainingUri!);
  if (!evaluation.isMatch) return parentResult.withNoNestedMatch();

  final result = parentResult.withNestedMatch(
    evaluation,
    (_) {
      throw StateError('This result is temporary and should not be returned');
    },
  );

  for (final route in routes) {
    final childResult = route.evaluate(result);
    if (childResult.isMatch) return childResult;
  }

  if (builder == null) return parentResult.withNoNestedMatch();
  return parentResult.withNestedMatch(evaluation, builder!);
}