onActive method

  1. @protected
  2. @mustCallSuper
void onActive(
  1. bool first
)

Implementation

@protected
@mustCallSuper
void onActive(bool first) {
  _delegate = Router.of(context).routerDelegate as StandardRouterDelegate?;

  _pageChildInstances = _delegate?._pageChildInstances;

  final Map<Type, List<Type>>? tStandardPagesMap =
      _delegate?._standardPagesMap;

  if (first && _pageChildInstances != null && tStandardPagesMap != null) {
    if (tStandardPagesMap.containsKey(_factory.pageType) &&
        tStandardPagesMap[_factory.pageType]!.isNotEmpty) {
      // Create an instance of the first child element to be displayed by default.
      var tStandardPageInterface =
          ModalRoute.of(context)?.settings as StandardPageInterface;

      final Type tChildPageType;
      if (_delegate?._targetFirstChildPage != null) {
        tChildPageType = _delegate!._targetFirstChildPage!.pageType;
      } else {
        tChildPageType = tStandardPagesMap[_factory.pageType]!.first;
      }

      _delegate?._standardPageInterfaceToType[tStandardPageInterface]!
          .add(tChildPageType);

      _firstPageFactory = _delegate?._addChildFirstPage(
        tChildPageType,
        tStandardPageInterface,
      );
    }
  }
}