performClick method

dynamic performClick(
  1. BuildContext context
)

Execute the action of the button click.

First, the action function will be executed to obtain the return value, and after the dialog will be closed, returning the obtained value.

Implementation

performClick(BuildContext context) async {
  if (action == null) {
    Navigator.of(context).pop();
  }

  T? result = (action != null ? action!(context) : null);
  if (result != null) {
    Navigator.of(context).pop(result);
  }
}