reportRouteWillDispose method

void reportRouteWillDispose(
  1. T disposed
)

Implementation

void reportRouteWillDispose(T 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) {
    Get.markAsDirty(key: element);

    //_routesKey.remove(element);
  }

  keysToRemove.clear();
}