Pop a route off the navigator that most tightly encloses the given context.
Tries to removes the current route, calling its didPop() method. If that method returns false, then nothing else happens. Otherwise, the observer (if any) is notified using its didPop() method, and the previous route is notified using Route.didChangeNext.
If non-null, result
will be used as the result of the route. Routes
such as dialogs or popup menus typically use this mechanism to return the
value selected by the user to the widget that created their route. The
type of result
, if provided, must match the type argument of the class
of the current route. (In practice, this is usually "dynamic".)
Returns true if a route was popped; returns false if there are no further previous routes.
Typical usage is as follows:
Navigator.pop(context);
Source
static bool pop(BuildContext context, [ dynamic result ]) { return Navigator.of(context).pop(result); }