This package enhances the interoperability between Dart and flutter_js.
Use this package to
flutter pub add flutter_js_context
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.