disposeDynamicRoutesInstance method

  1. @override
void disposeDynamicRoutesInstance(
  1. Widget initiatorWidget, {
  2. required bool clearCacheRelatedData,
})
inherited

Remove reference to all instantiated objects from the_dynamicRoutesInstances array.

Implementation

@override
void disposeDynamicRoutesInstance(Widget initiatorWidget,
    {required bool clearCacheRelatedData}) {
  final participators =
      _initiatorAndParticipatorsMap[initiatorWidget.hashCode] ?? [];

  for (final p in participators) {
    _dynamicRoutesInstances[p.hashCode] = null;
    if (clearCacheRelatedData) {
      _participatorAndInitiatorMap[p.hashCode] = null;
    }
  }

  _initiatorAndParticipatorsMap[initiatorWidget.hashCode] = null;
  if (clearCacheRelatedData) {
    _initiatorCacheMap[initiatorWidget.hashCode] = null;
  }
}