popAndPushNamed<T extends Object, TO extends Object> method

  1. @optionalTypeArgs
Future<T> popAndPushNamed <T extends Object, TO extends Object>(BuildContext context, String routeName, { TO result })

Pop the current route off the navigator that most tightly encloses the given context and push a named route in its place.

Sample code

Typical usage is as follows:

void _selectNewYork() {
  Navigator.popAndPushNamed(context, '/nyc/1776');
}

Implementation

@optionalTypeArgs
static Future<T> popAndPushNamed<T extends Object, TO extends Object>(BuildContext context, String routeName, { TO result }) {
  return Navigator.of(context).popAndPushNamed<T, TO>(routeName, result: result);
}