pushNamed<T extends Object?> method

Future<T?> pushNamed<T extends Object?>(
  1. BuildContext context,
  2. String routeName, {
  3. Object? arguments,
})
inherited

This method is replacement of Navigator.pushNamed(), but fires onResume() after route popped

Implementation

Future<T?> pushNamed<T extends Object?>(
    BuildContext context, String routeName,
    {Object? arguments}) {
  _isPaused = true;
  onPause();

  return Navigator.of(context)
      .pushNamed<T>(routeName, arguments: arguments)
      .then((value) {
    _isPaused = false;

    resume.data = value;
    resume.source = routeName;

    onResume();
    return value;
  });
}