/// Web-specific utilities for browser operations. library; import 'package:web/web.dart' as web; /// Redirect the browser to a URL. void redirectTo(String url) { web.window.location.href = url; } /// Get the current browser URL. String getCurrentUrl() { return web.window.location.href; } /// Replace the current URL in history without navigation. void replaceUrl(String url) { web.window.history.replaceState(null, '', url); } /// Store a value in sessionStorage. void setSessionStorage(String key, String value) { web.window.sessionStorage.setItem(key, value); } /// Get a value from sessionStorage. String? getSessionStorage(String key) { return web.window.sessionStorage.getItem(key); } /// Remove a value from sessionStorage. void removeSessionStorage(String key) { web.window.sessionStorage.removeItem(key); }