Future<T> showDialog<T>({@required BuildContext context, bool barrierDismissible: true, @required Widget child })

Displays a dialog above the current contents of the app.

This function typically receives a Dialog widget as its child argument. Content below the dialog is dimmed with a ModalBarrier.

The context argument is used to look up the Navigator and Theme for the dialog. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the dialog is closed.

Returns a Future that resolves to the value (if any) that was passed to Navigator.pop when the dialog was closed.

See also:

Source

Future<T> showDialog<T>({
  @required BuildContext context,
  bool barrierDismissible: true,
  @required Widget child,
}) {
  return Navigator.of(context, rootNavigator: true).push(new _DialogRoute<T>(
    child: child,
    theme: Theme.of(context, shadowThemeOnly: true),
    barrierDismissible: barrierDismissible,
  ));
}