reportRouteWillDispose static method

void reportRouteWillDispose(
  1. Route disposed
)

Implementation

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

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

  /// Removes `Get.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) {
    GetInstance().markAsDirty(key: element);

    //_routesKey.remove(element);
  }

  keysToRemove.clear();
}