Skip to content
pubscout

web

1.1.2, released 4 weeks ago by dart.dev

Lightweight bindings for browser APIs via JS interop

WASM-readyRock solid
$ flutter pub add web
Source repository

What it does

Provides Dart wrappers around standard web APIs such as document, XMLHttpRequest, WebAssembly, and more. It replaces dart:html for Dart compiled to JS or WASM.

AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Migrating a Dart web app from dart:html to a more modern API
  • Need direct access to browser APIs in a Dart-only codebase
  • Want zero‑overhead bindings for web features

Skip it when

  • You only need a subset of APIs and prefer a smaller dependency
  • You are targeting non‑web platforms

Strengths

  • Zero‑overhead, type‑safe bindings
  • Supports both JS and WASM targets
  • Actively maintained with migration guides
  • No build_runner or code generation required

Weaknesses

  • Only works on web platforms
  • No support for native mobile or desktop APIs
  • Requires Dart 3.13+

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add dependency to pubspec and import 'package:web/web.dart';

import 'package:web/web.dart';

void main() {
  final div = document.querySelector('div')!;
  div.text = 'Text set at ${DateTime.now()}';
}

Alternatives

Packages that do the same job and could replace web.

  • sodium

    Dart bindings for the libsodium cryptographic library for Dart-VM and Web.

Works with

Packages commonly used together with web: ones it builds on, ones built on it, and its own family.