dartified 1.0.0 copy "dartified: ^1.0.0" to clipboard
dartified: ^1.0.0 copied to clipboard

Life-saving helpers for working with JavaScript libraries when compiling Dart/Flutter to Web.

example/dartified_example.dart

import 'dart:js' as js;

import 'package:dartified/dartified.dart';

/// An example using browser's fetch.
Future<void> main() async {
  try {
    var response = await Dartified.promiseToFuture(
      js.context.callMethod(
        Dartified.jsify('fetch'),
        [
          Dartified.jsify(
            'https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits',
          ),
        ],
      ),
    );

    var json =
        await Dartified.promiseToFuture<String>(response.callMethod('json'));

    print(Dartified.dartify(json));
  } catch (e) {
    print('error: $e');
  }
}
3
likes
90
points
16
downloads

Publisher

verified publisherhammed.dev

Weekly Downloads

Life-saving helpers for working with JavaScript libraries when compiling Dart/Flutter to Web.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on dartified