closeOverlay<T> function
Closes the currently active overlay with an optional result value.
Searches up the widget tree for the OverlayCompleter of the overlay
context is inside of (inherited by the overlay's own content) and
requests it to close with the provided result. If none is found, returns
a completed future.
Parameters:
context(BuildContext, required): Build context from within the overlayvalue(T?): Optional result value to return when closing
Returns a Future that completes when the overlay is closed.
Example:
closeOverlay(context, 'user_confirmed');
Implementation
Future<void> closeOverlay<T>(BuildContext context, [T? value]) {
return Data.maybeFind<OverlayCompleter>(context)?.closeWithResult(value) ??
Future.value();
}