Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dart-lang/web
Lightweight browser API bindings built around JS static interop.
https://github.com/dart-lang/web
dart
Last synced: 2 days ago
JSON representation
Lightweight browser API bindings built around JS static interop.
- Host: GitHub
- URL: https://github.com/dart-lang/web
- Owner: dart-lang
- License: bsd-3-clause
- Created: 2023-01-12T23:24:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-01T07:00:23.000Z (20 days ago)
- Last Synced: 2025-02-12T08:05:12.683Z (9 days ago)
- Topics: dart
- Language: Dart
- Homepage: https://pub.dev/packages/web
- Size: 3.21 MB
- Stars: 137
- Watchers: 31
- Forks: 28
- Open Issues: 59
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/dart-lang/web/actions/workflows/dart.yml)
[](https://pub.dev/packages/web)
[](https://pub.dev/packages/web/publisher)Lightweight browser API bindings built around
[JS interop](https://dart.dev/interop/js-interop).## What's this?
This package exposes browser APIs. It's generated from the Web IDL definitions
and uses recent Dart language features for zero-overhead bindings.This package is intended to replace
[`dart:html`](https://api.dart.dev/stable/dart-html/dart-html-library.html) and
similar Dart SDK libraries. It will support access to browser APIs from Dart
code compiled to either JavaScript or WebAssembly.## Usage
```dart
import 'package:web/web.dart';void main() {
final div = document.querySelector('div')!;
div.text = 'Text set at ${DateTime.now()}';
}
```## Migrating to package:web
`package:web` is replacing `dart:html` and other web libraries as Dart's
long-term web interop solution. To learn how to migrate from `dart:html`
APIs to `package:web`, see our
[migration guide](https://dart.dev/go/package-web).## Generation
This package is generated by `web_generator`. See the
[`README`](https://github.com/dart-lang/web/tree/main/web_generator) for more
details on the conventions used to generate this package and how to run the
different tools to generate bindings and update various package dependencies.