validatePush method

SkinViolation? validatePush(
  1. String? routeName
)

Validates one push. Returns the violation when the pushed route does not conform, null when it does.

Implementation

SkinViolation? validatePush(String? routeName) {
  if (allows(routeName)) return null;
  final name = routeName!;
  final sorted = _allowedRoutes.toList()..sort();
  return SkinViolation.route(
    rowId: 'route:$name',
    requirement: 'route $name is declared by the route contract',
    message:
        'push of undeclared route; allowed routes: '
        '${sorted.isEmpty ? '(none declared)' : sorted.join(', ')}',
    route: name,
  );
}