pop<T extends Object> method

  1. @optionalTypeArgs
bool pop <T extends Object>(BuildContext context, [ T result ])

Pop the top-most route off the navigator that most tightly encloses the given context.

Sample code

Typical usage for closing a route is as follows:

void _close() {
  Navigator.pop(context);
}

A dialog box might be closed with a result:

void _accept() {
  Navigator.pop(context, true); // dialog returns true
}

Implementation

@optionalTypeArgs
static bool pop<T extends Object>(BuildContext context, [ T result ]) {
  return Navigator.of(context).pop<T>(result);
}