pushNamedDetails<T extends Object?> static method

Future<T?> pushNamedDetails<T extends Object?>(
  1. BuildContext context,
  2. String routeName,
  3. {Object? arguments,
  4. bool rootNavigator = false}
)

Pushes a named details route, either onto the split navigator if available or onto the regular navigator.

context is the BuildContext of the current widget tree. routeName is the name of the route to be pushed. arguments are the optional arguments to be passed to the route. rootNavigator is an optional flag to force using the root navigator.

Implementation

static Future<T?> pushNamedDetails<T extends Object?>(
  BuildContext context,
  String routeName, {
  Object? arguments,
  bool rootNavigator = false,
}) {
  return _handleNavigation(
    context: context,
    rootNavigator: rootNavigator,
    regularNavigatorAction: (NavigatorState state) {
      return state.pushNamed(routeName, arguments: arguments);
    },
    splitNavigatorAction: (NavigatorState state) {
      return state.pushNamedAndRemoveUntil(
        routeName,
        ModalRoute.withName(ZdsSplitNavigator.emptyRoute),
        arguments: arguments,
      );
    },
  );
}