toggleModals static method

void toggleModals(
  1. GoRouter router,
  2. List<String> modalIds
)

Toggles each id in modalIds: closes it if open, opens it otherwise.

Implementation

static void toggleModals(GoRouter router, List<String> modalIds) {
  final currentLocation = router.state.uri;
  final newUri = toggleModalsInUri(currentLocation, modalIds);

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