universal_web 1.1.0+1 copy "universal_web: ^1.1.0+1" to clipboard
universal_web: ^1.1.0+1 copied to clipboard

Lightweight browser API bindings built around JS interop.

example/example.dart

// Copyright (c) 2023, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:universal_web/web.dart';

/// A constant that is true if the application was compiled to run on the web.
const bool kIsWeb = bool.fromEnvironment('dart.library.js_interop');

void main() {
  if (kIsWeb) {
    final div = document.querySelector('div')!;
    div.text = 'Text set at ${DateTime.now()}';
  }
}
14
likes
140
points
107
downloads

Publisher

verified publisherschultek.dev

Weekly Downloads

Lightweight browser API bindings built around JS interop.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

web

More

Packages that depend on universal_web