s_universal_html/s_universal_html library
High-level helpers for web DOM operations.
Use SUniversalHtml instead of importing html.dart directly and calling
html.window / html.document everywhere. This avoids boilerplate,
centralises the platform guard, and provides a single API that works on
both JS-compiled and WASM-compiled Flutter web.
Implemented with package:web + dart:js_interop on web platforms and
safe no-op stubs on native platforms.
Example:
// Before
html.document.onContextMenu.listen((e) => e.preventDefault());
final href = html.window.location.href;
// After
final cancel = SUniversalHtml.preventDefaultContextMenu();
final href = SUniversalHtml.windowLocationHref;
Classes
- SUniversalHtml
- A collection of safe, zero-boilerplate helpers for browser DOM operations.