closeDrawer<T> function

Future<void> closeDrawer<T>(
  1. BuildContext context, [
  2. T? result
])

Closes the currently open drawer overlay.

Dismisses the active drawer from the overlay stack. Optionally returns a result value to the code that opened the drawer.

Parameters:

  • context (BuildContext, required): Build context from within the drawer.
  • result (T?, optional): Optional result to return.

Returns: Future<void> that completes when drawer is closed.

Implementation

Future<void> closeDrawer<T>(BuildContext context, [T? result]) {
  final data = Data.maybeOf<_MountedOverlayEntryData>(context);
  assert(data != null, 'No DrawerEntryWidget found in the widget tree');
  return data!.state.close(result);
}