JavaScriptCore for Flutter use dart:ffi

JavaScriptCore for Flutter use dart:ffi

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


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


Screen recording Apk
Code Download

Getting Started

Add plugin

// pub
  flutter_jscore: ^last_version

// import
    path: Your local path

// git
      url: git://

Add dynamic library

Due to the size limitation of pub on package upload, you need to add JavaScriptCore dynamic library to the project by yourself. You can refer to the example. of course you can refer to webkit to compile it. Set JscFfi.lib to use the JavaScriptCore dynamic library.

JscFfi.lib = Platform.isIOS || Platform.isMacOS
  : Platform.isWindows
  : Platform.isLinux

You can get the aar file containing in jsc-android, and add to your project. Take the libs folder as an example, add it to the build.gradle of the module.

android {
    repositories {
        flatDir {
            dirs 'libs'
dependencies {
    implementation(name:'**', ext:'aar')

You also need to add, because this is a dependency of Take the jniLibs folder as an example, add it to the build.gradle of the module.

android {
    sourceSets {
        main {
            jniLibs.srcDirs = ['jniLibs']

If your project uses C++, then you can add the code in the module’s build.gradle.

android {
    defaultConfig {
        externalNativeBuild {
            make {
                arguments "-DANDROID_STL=c++_shared"
iOS and macOS

You don’t need to do anything, because JavaScriptCore comes with iOS and macOS.


You can use the dynamic library in the example, or compile it yourself. And configure in CMakeLists.txt.

# Add JavaScriptCore libs
  COMPONENT Runtime)

You can use libjavascriptcoregtk as a dependency, or compile webkitgtk yourself. The names of dynamic libraries in different Linux distributions may be different. So you need to set JscFfi.lib.

ubuntn or Debian

apt-get install libjavascriptcoregtk-4.0-18
JscFfi.lib ='');


pacman -S webkit2gtk
JscFfi.lib ='');


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');


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



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.


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.



I don't think there is much to describe, flutter_jscore just makes a simple package. You can refer to the documentation of JavaScriptCore and the documentation on pub.




If you like my project, please in the upper right corner of the project "Star". Your support is my biggest encouragement! ^_^ You can also scan the qr code below or Donate to this project using Paypal, donation to Author.

If in donation message note name, will be record to the list if you are making open source authors, donation can leave when making project address or personal home page, a link will be added to the list have the effect of promoting each other

Donation list

QQ Group - 554981921

Into the group of instructions

The group is not only solve the problem of EasyreFresh, any Flutter related issues can be discussed. Just as its name, craigslist, as long as there is time, group of Lord will help you solve problems together.

Download Details:

Author: xuelongqy Download Link: Download The Source Code Official Website: License: MIT

javascript flutter dart

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Google's Flutter 1.20 stable announced with new features - Navoki

Google has announced new flutter 1.20 stable with many improvements, and features, enabling flutter for Desktop and Web

What is Flutter and why you should learn it?

Flutter is an open-source UI toolkit for mobile developers, so they can use it to build native-looking Android and iOS applications from the same code base for both platforms. Flutter is also working to make Flutter apps for Web, PWA (progressive Web-App) and Desktop platform (Windows,macOS,Linux).

6 Things About HTTP Request in Dart For Beginners

Here is an http request to get a user's data using GET request, First, we have to make an async function that returns a type. If you are here and a beginner, that means you want to learn everything about making an API request using Dart in Flutter, then you are in the right place for the HTTP tutorial.

Adobe XD plugin for Flutter with CodePen Tutorial

Recently Adobe XD releases a new version of the plugin that you can use to export designs directly into flutter widgets or screens.

Flutter for the JavaScript web developer

Flutter for the JS Developer - Flutter/Dart basics for the JavaScript web developer. Learn the similarities and differences between Dart and JS side-by-side.