import 'package:web/web.dart' as web; /// Per-tab storage for the PKCE verifier + CSRF state (cleared when the tab /// closes), and the little bit of `window` access the OIDC redirect needs. void setSession(String key, String value) => web.window.sessionStorage.setItem(key, value); String? getSession(String key) => web.window.sessionStorage.getItem(key); void removeSession(String key) => web.window.sessionStorage.removeItem(key); void redirect(String url) => web.window.location.assign(url); Map currentQueryParameters() => Uri.parse(web.window.location.href).queryParameters; /// Drop the OIDC callback path + `?code=…&state=…` from the address bar /// without reloading (back to the app root). void clearQuery() { web.window.history.replaceState(null, '', '/'); }