closeModal static method

void closeModal(
  1. GoRouter router,
  2. String modalId
)

Removes modalId from the modal query parameter, dropping the parameter entirely if it was the last one open.

Implementation

static void closeModal(GoRouter router, String modalId) {
  final currentLocation = router.state.uri;
  final newUri = closeModalInUri(currentLocation, modalId);

  if (newUri != currentLocation) {
    router.go(newUri.toString(), extra: router.state.extra);
  }
}