pushWidget<T> method

Future<T?> pushWidget<T>(
  1. Widget child, {
  2. String? name,
})

Pushes a widget directly as a PageRoute.

Convenience method that wraps widget in a PageRoute.

Implementation

Future<T?> pushWidget<T>(Widget child, {String? name}) {
  return push<T>(
    PageRoute<T>(
      builder: (_) => child,
      settings: RouteSettings(name: name),
    ),
  );
}