reportRouteWillDispose method

void reportRouteWillDispose(
  1. T disposed
)

Implementation

void reportRouteWillDispose(T disposed) {
  final keysToRemove = <String>[];

  _routesKey[disposed]?.forEach(keysToRemove.add);

  /// Removes `June.create()` instances registered in `routeName`.
  if (_routesByCreate.containsKey(disposed)) {
    for (final onClose in _routesByCreate[disposed]!) {
      // assure the [DisposableInterface] instance holding a reference
      // to onClose() wasn't disposed.
      onClose();
    }
    _routesByCreate[disposed]!.clear();
    _routesByCreate.remove(disposed);
  }

  for (final element in keysToRemove) {
    June.markAsDirty(key: element);

    //_routesKey.remove(element);
  }

  keysToRemove.clear();
}