closeModalAsync method

Future<void> closeModalAsync(
  1. String modalId, {
  2. BuildContext? context,
})

Async version of closeModal — await it before navigating further to guarantee the router has already updated.

Implementation

Future<void> closeModalAsync(String modalId, {BuildContext? context}) async {
  final router = context != null ? GoRouter.of(context) : _getRouter();
  await NavigationUtils.closeModalAsync(router, modalId);
}