addRoute method

  1. @override
void addRoute({
  1. required dynamic routeName,
  2. AppTabType? tab,
  3. required UIRouteSettings settings,
})
override

Adds specific route to stack Can be screen route, dialog route or bottom sheet route Therefore route name is dynamic CurrentTab is always null for global navigation

Implementation

@override
void addRoute({
  required dynamic routeName,
  AppTabType? tab,
  required UIRouteSettings settings,
}) {
  if (tab == null) {
    return;
  }

  final current = Map<AppTabType, List<UIRouteModel>>.from(stack);

  if (current.containsKey(tab)) {
    final currentList = List<UIRouteModel>.from(current[tab] ?? []);

    // ignore: cascade_invocations
    currentList.add(UIRouteModel(
      name: routeName,
      settings: settings,
    ));

    current[tab] = currentList;
  }

  _tabRouteStack.update(current);
}