flutter_quickjs 1.0.0 flutter_quickjs: ^1.0.0 copied to clipboard
Flutter bindings for QuickJS with dart:ffi.
flutter_quickjs #
Flutter bindings with dart:ffi for QuickJS:A small Javascript engine supports ES2020.
Supports iOS, Android.
Install #
To use this plugin, add flutter_quickjs
as a dependency in your pubspec.yaml file.
Usage #
import 'package:flutter/material.dart';
import 'package:flutter_quickjs/flutter_quickjs.dart';
void main() {
var evalResult = runJs();
runApp(
MaterialApp(
home: Material(
child: Center(
child: Text(evalResult),
),
),
),
);
}
runJs() {
var qjs = new FlutterQuickjs();
var res;
try {
res = qjs.eval('Math.PI');
} catch (e) {
res = e.message;
}
qjs.close();
return res.toString();
}
More usages see example
Todo #
- bytecode support
- support more platforms like macos,linux
Reference #
Lincense #
MIT © ZhangPingFan