dvDocsMountConflict function

String? dvDocsMountConflict(
  1. String mount,
  2. Map<String, String> pages
)

Why a page cannot be where it is, given the mount, or null.

The docs site owns its mount and everything under it, so an application page at either is shadowed rather than colliding visibly -- and which of the two disappears depends on the order they were registered in. That makes it a build-time refusal: a build that picks silently is a build that moves the bug somewhere else.

Implementation

String? dvDocsMountConflict(String mount, Map<String, String> pages) {
  final DVDocsMount docs =
      DVDocsMount(path: mount, enabled: true, access: DVDocsAccess.public);
  for (final MapEntry<String, String> page in pages.entries) {
    if (!docs.owns(page.key)) continue;
    return 'The page in ${page.value} claims "${page.key}", which is inside '
        'the docs mount "$mount". One of the two would be unreachable, and '
        'which one depends on the order they are registered in. Move the '
        'page, or move the docs with dartvel.docs.path in pubspec.yaml.';
  }
  return null;
}