pop<T> function

void pop<T>(
  1. BuildContext context, {
  2. T? result,
})

A Dart function that pops the current route off the navigation stack and returns an optional result.

Parameters:

  • context: the BuildContext associated with the current widget tree.
  • result: an optional generic value representing the result to be returned to the previous route.

Returns: This function returns void, as it simply pops the current route off the navigation stack and returns an optional result.

Example usage: // Pops the current route off the navigation stack and returns a String result.

pop<String>(context, result: "Hello World!");

Implementation

void pop<T>(BuildContext context, {T? result}) => Navigator.of(context).pop<T>(result);