launch<T> method

Future<T?> launch<T>(
  1. BuildContext context, {
  2. bool isNewTask = false,
  3. PageRouteAnimation? pageRouteAnimation,
  4. Duration? duration,
})

Launch a new screen

Implementation

Future<T?> launch<T>(BuildContext context,
    {bool isNewTask = false,
    PageRouteAnimation? pageRouteAnimation,
    Duration? duration}) async {
  if (isNewTask) {
    return await Navigator.of(context).pushAndRemoveUntil(
      buildPageRoute(
          this!, pageRouteAnimation ?? pageRouteAnimationGlobal, duration),
      (route) => false,
    );
  } else {
    return await Navigator.of(context).push(
      buildPageRoute(
          this!, pageRouteAnimation ?? pageRouteAnimationGlobal, duration),
    );
  }
}