prefetchRoute method

Future<void> prefetchRoute(
  1. String path
)

Prefetches route data and lazily-loaded components for path using this router instance.

Implementation

Future<void> prefetchRoute(String path) async {
  final clean = path.split('?').first.split('#').first;
  if (_prefetchedPaths.contains(clean)) return;
  _prefetchedPaths.add(clean);

  try {
    final m = match(clean);
    if (m == null) return;
    await _warmMatch(m);
  } catch (_) {
    _prefetchedPaths.remove(clean);
  }
}