flutter_jscore

JavaScriptCore for Flutter. The plugin provides the ability to evaluate JavaScript programs from within dart.

flutter_jscore

Getting Started

Add dependency

// pub
dependencies:
  flutter_jscore: ^last_version

// import
dependencies:
  flutter_jscore:
    path: Your local path

// git
dependencies:
  flutter_jscore:
    git:
      url: git://github.com/xuelongqy/flutter_jscore.git

Super simple to use

import 'package:flutter_jscore/flutter_jscore.dart';

void runJS() {
    JSContext jsContext = JSContext.createInGroup();
    // Replace '1 + 1' with your JavaScript code
    JSValue jsValue = jsContext.evaluate('1 + 1');
    print(jsValue.string);
    jsContext.release();
}

JavaScriptCore

Evaluate JavaScript programs from within an app, and support JavaScript scripting of your app.

Documentation

dart:ffi

Foreign Function Interface for interoperability with the C programming language. flutter_jscore uses dart:ffi so you don't have to worry about performance loss across programming languages.

dart:ffi

Supported platforms

  • iOS (7.0+)
  • macOS (10.5+)
  • Android (arm32, arm64, x86, x86_64)
  • Windows (x86_64)
  • Linux (x86_64)

Linux dependencies

If you use it on Linux, you must make sure to have the following dependencies.

  • libglib-2.0.so.0
  • libicui18n.so.66
  • libicuuc.so.66
  • libdl.so.2
  • libgio-2.0.so.0
  • libgobject-2.0.so.0
  • libpthread.so.0
  • libstdc++.so.6
  • libm.so.6
  • libgcc_s.so.1
  • libc.so.6
  • ld-linux-x86-64.so.2

GitHub

https://github.com/xuelongqy/flutter_jscore