openModal static method

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

Adds modalId to the modal query parameter, comma-joined with any modals already open.

Implementation

static void openModal(GoRouter router, String modalId) {
  try {
    final currentLocation = router.state.uri;
    final newUri = openModalInUri(currentLocation, modalId);

    if (newUri != currentLocation) {
      router.go(newUri.toString(), extra: router.state.extra);
    }
  } on Object catch (e, stackTrace) {
    debugPrint('[NavigationUtils] ❌ Ошибка при открытии модального окна: $e');
    debugPrint('[NavigationUtils] Stack trace: $stackTrace');
  }
}