flutter_js_context 0.1.0 copy "flutter_js_context: ^0.1.0" to clipboard
flutter_js_context: ^0.1.0 copied to clipboard

Enhances the interoperability between Dart and flutter_js.

This package enhances the interoperability between Dart and flutter_js.

Features #

Use this package to

  • Track which variables are defined.
  • Decode evaluated results that the type is assumed as JSON always.
  • Load JavaScript file properly.

Getting started #

flutter pub add flutter_js_context

Usage #

import 'package:flutter_js_context/flutter_js_context.dart';

void main() {
  final context = JsContext();

  JsRef obj = JsRef.define(context, 'myvar', '1');

  // equals 'var myvar[ref.key] = 4;' in JavaScript.
  obj.update("4");

  // plus the object's value which is 4 and 4 in javascript runtime.
  context.evaluate("${obj.toJsCode()} + 4"); // 8

  // plus the object's value which is 8 and 4 in dart.
  print(obj.value + 4); // 12
}

See test for more usage.

#

0
likes
100
pub points
0%
popularity

Publisher

verified publishercuilian.io

Enhances the interoperability between Dart and flutter_js.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_js, short_uuids

More

Packages that depend on flutter_js_context