dvDocsMountProblem function

String? dvDocsMountProblem(
  1. String path
)

Why path cannot be a mount, or null when it can be.

Refused rather than repaired. A path with no leading slash never matches a request, because a request path always does.

Implementation

String? dvDocsMountProblem(String path) {
  final String value = path.trim();
  if (!value.startsWith('/')) {
    return 'The docs path has to begin with "/". "$value" never matches a '
        'request, because a request path always does.';
  }
  if (_normalise(value).isEmpty) {
    return 'The documentation cannot be mounted at "/": it owns everything '
        'below its mount, and everything below "/" is the application.';
  }
  if (value.contains(':') || value.contains('*')) {
    return 'The docs path is a literal, not a template. "$value" would match '
        'routes the application means to serve itself.';
  }
  return null;
}