getRouteDependence method
Implementation
T? getRouteDependence(BuildContext? context) {
if (context == null) return _currentDependence;
final route = ModalRoute.of(context);
if (route == null) return _currentDependence;
final value = _caches[route];
if (value != null) return value;
final currentRouteDep = createNode(route);
_caches[route] = currentRouteDep;
route.completed.whenComplete(() {
final dependence = _caches.remove(route);
dependence?.completed();
});
if (_currentDependence != null) {
_currentDependence!.insertChild(currentRouteDep);
}
return _currentDependence = currentRouteDep;
}