push<T extends Object?> static method
Future<T?>
push<T extends Object?>(
- BuildContext context,
- Widget child, {
- RouteSettings? settings,
- PylonRouteType type = PylonRouteType.material,
- Route<
T> ? route,
Pushes a new route to the navigator with all visible Pylon widgets from the current context.
This method creates a new route that includes all non-local ancestral pylons from the current context, making those pylon values available in the new route.
The context is the build context from which to get current pylons.
The child is the widget to display in the new route.
The settings are optional route settings.
The type is the type of route to create (material or cupertino).
The route is an optional custom route to use instead of the default.
Returns a Future that completes with the value returned by the new route.
Example:
Pylon.push(context, DetailScreen());
Implementation
static Future<T?> push<T extends Object?>(
BuildContext context,
Widget child, {
RouteSettings? settings,
PylonRouteType type = PylonRouteType.material,
Route<T>? route,
}) =>
Navigator.push<T?>(
context,
route ??
switch (type) {
PylonRouteType.material => Pylon.materialPageRoute(
context, (context) => child,
settings: settings),
PylonRouteType.cupertino => Pylon.cupertinoPageRoute(
context, (context) => child,
settings: settings),
});