reportRouteWillDispose method
void
reportRouteWillDispose(
- T disposed
Reports the impending disposal of a route.
This method is called just before a route is disposed, and it ensures that instances and dependencies are properly handled before the route is removed from memory.
Implementation
void reportRouteWillDispose(T disposed) {
final List<String> keysToRemove = <String>[];
_routesKey[disposed]?.forEach(keysToRemove.add);
if (_routesByCreate.containsKey(disposed)) {
for (final Function onClose in _routesByCreate[disposed]!) {
onClose();
}
_routesByCreate[disposed]!.clear();
_routesByCreate.remove(disposed);
}
for (final String element in keysToRemove) {
Get.markAsDirty(key: element);
}
keysToRemove.clear();
}