{"id":13550838,"url":"https://github.com/abner/flutter_js","last_synced_at":"2026-02-22T03:40:53.213Z","repository":{"id":36566568,"uuid":"228179110","full_name":"abner/flutter_js","owner":"abner","description":"A Javascript engine to use with flutter. It uses quickjs on Android and JavascriptCore on IOS","archived":false,"fork":false,"pushed_at":"2026-01-27T20:17:41.000Z","size":5292,"stargazers_count":528,"open_issues_count":75,"forks_count":174,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-02-15T04:52:27.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"abner"}},"created_at":"2019-12-15T12:17:55.000Z","updated_at":"2026-02-08T02:03:14.000Z","dependencies_parsed_at":"2024-01-18T18:25:37.240Z","dependency_job_id":"30e7aa72-3a3a-4638-a98b-5a722312e55e","html_url":"https://github.com/abner/flutter_js","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/abner/flutter_js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abner%2Fflutter_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abner%2Fflutter_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abner%2Fflutter_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abner%2Fflutter_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abner","download_url":"https://codeload.github.com/abner/flutter_js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abner%2Fflutter_js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:01:38.358Z","updated_at":"2026-02-22T03:40:53.190Z","avatar_url":"https://github.com/abner.png","language":"Dart","readme":"# Flutter JS plugin\n\nA Javascript engine to use with flutter. Now it is using QuickJS on Android   through Dart ffi and JavascriptCore on IOS also through dart-ffi. The Javascript runtimes runs synchronously through the dart ffi. So now you can run javascript code as a native citzen inside yours Flutter ~~Mobile~~ Apps (Android, IOS, Windows, Linux and MacOS are all supported).\n\nIn the previous versions we only get the result of evaluated expressions as String. \n\n**BUT NOW** we can do more with  flutter_js, like run **xhr** and **fetch** http calls through Dart http library. We are supporting **Promises** as well.\n\nWith flutter_js Flutter applications can take advantage of great javascript libraries such as ajv (json schema validation), moment (DateTime parser and operations) running natively (no PlatformChannels needed) on mobile devices, both Android and iOS.\n\nOn IOS this library relies on the native JavascriptCore provided by iOS SDK. In Android it uses the amazing and small Javascript Engine QuickJS [https://bellard.org/quickjs/](https://bellard.org/quickjs/) (A spetacular work of the Fabrice Bellard and Charlie Gordon).\n\nTo debug JS code on iOS you need to set `javascriptRuntime.setInspectable(true);` and pass sourceUrl to `evaluate` (example: sourceUrl: 'script.js').\n\nOn Android you could use JavascriptCore as well You just need add an Android dependency `implementation \"com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-jsc:0.3.4\"` and pass `forceJavascriptCoreOnAndroid: true` to the function `getJavascriptRuntime`. \n\n\nOn MacOS the JavascriptCore, provided by the OSX is used. In Windows and Linux the engine used is the QuickJS. In the 0.4.0 version we borrowed the dart ffi source code from the flutter_qjs lib. `flutter_qjs` is a amazing package and they made a excelent work in build a good ffi bridge between Dart and JS, also doing the quickjs source code changes to allow it to run on WIndows. But, flutter_js take the approach to use JavascriptCore on IOS (mainly) to avoid refusals on the Apple Store, which state that `Apps may contain or run code that is not embedded in the binary (e.g. HTML5-based games, bots, etc.), as long as code distribution isn’t the main purpose of the app`. It also says `your app must use WebKit and JavaScript Core to run third-party software and should not attempt to extend or expose native platform APIs to third-party software;` Reference: https://developer.apple.com/app-store/review/guidelines/ [ Session  4.7]. So, we avoid to use quickjs in IOS apps, so flutter_js provides an abstraction called JavascriptRuntime which runs using JavascriptCore on Apple devices and Desktop and QuickJS in Android, Windows and Linux.\n\nFLutterJS allows to use Javascript to execute validations logic of TextFormField, also we can execute rule engines or redux logic shared from our web applications. The opportunities are huge.\n\n\nThe project is open source under MIT license. \n\nThe bindings for use to communicate with JavascriptCore through dart:ffi we borrowed it from the package [flutter_jscore](https://pub.dev/packages/flutter_jscore).\n\nFlutter JS provided the implementation to the QuickJS dart ffi bindings and also constructed a wrapper API to Dart which provides a unified API to evaluate javascript and communicate between Dart and Javascript through QuickJS and Javascript Core in a unified way. \n\nThis library also allows to call xhr and fetch on Javascript through Dart Http calls. We also provide the implementation which allows to evaluate promises.\n\n\n![](doc/flutter_js.png)\nFlutter JS on Mobile\n\n![](doc/macos-capture.png)\nFlutter JS on Desktop\n\n\n## Features:\n\n## Instalation\n\n```yaml\ndependencies:\n  flutter_js: 0.1.0+0\n```\n\n### iOS\n\nSince flutter_js uses the native JavascriptCore, no action is needed.\n\n### Android\n\nChange the minimum Android sdk version to 21 (or higher) in your `android/app/build.gradle` file.\n\n```\nminSdkVersion 21\n```\n\n## Release Deploy\n\n### Android\n\nSetup of proguard to release builds: setup your android/app/proguard-rules.pro file \nwith the content bellow.\n\n\u003e Remember to merge with another configurations needed for \nothers plugins your app uses.\n\n```proguard-rules.pro\n#Flutter Wrapper\n-keep class io.flutter.app.** { *; }\n-keep class io.flutter.plugin.**  { *; }\n-keep class io.flutter.util.**  { *; }\n-keep class io.flutter.view.**  { *; }\n-keep class io.flutter.**  { *; }\n-keep class io.flutter.plugins.**  { *; }\n-keep class de.prosiebensat1digital.** { *; }\n``` \n\nAlso add these lines to your `android -\u003e buildTypes -\u003e release` section of android/app/build.gradle file:\n\n```gradle\n minifyEnabled true\n  useProguard true\n\n  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n```\n \n\n## Examples\n\nHere is a small flutter app showing how to evaluate javascript code inside a flutter app\n\n\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'dart:async';\n\nimport 'package:flutter/services.dart';\nimport 'package:flutter_js/flutter_js.dart';\n\nvoid main() =\u003e runApp(MyApp());\n\nclass MyApp extends StatefulWidget {\n  @override\n  _MyAppState createState() =\u003e _MyAppState();\n}\n\nclass _MyAppState extends State\u003cMyApp\u003e {\n  String _jsResult = '';\n  JavascriptRuntime flutterJs;\n  @override\n  void initState() {\n    super.initState();\n    \n    flutterJs = getJavascriptRuntime();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: Scaffold(\n        appBar: AppBar(\n          title: const Text('FlutterJS Example'),\n        ),\n        body: Center(\n          child: Column(\n            mainAxisAlignment: MainAxisAlignment.center,\n            children: \u003cWidget\u003e[\n              Text('JS Evaluate Result: $_jsResult\\n'),\n              SizedBox(height: 20,),\n              Padding(padding: EdgeInsets.all(10), child: Text('Click on the big JS Yellow Button to evaluate the expression bellow using the flutter_js plugin'),),\n              Padding(\n                padding: const EdgeInsets.all(8.0),\n                child: Text(\"Math.trunc(Math.random() * 100).toString();\", style: TextStyle(fontSize: 12, fontStyle: FontStyle.italic, fontWeight: FontWeight.bold),),\n              )\n            ],\n          ),\n        ),\n        floatingActionButton: FloatingActionButton(\n          backgroundColor: Colors.transparent, \n          child: Image.asset('assets/js.ico'),\n          onPressed: () async {\n            try {\n              JsEvalResult jsResult = flutterJs.evaluate(\n                  \"Math.trunc(Math.random() * 100).toString();\");\n              setState(() {\n                _jsResult = jsResult.stringResult;\n              });\n            } on PlatformException catch (e) {\n              print('ERRO: ${e.details}');\n            }\n          },\n        ),\n      ),\n    );\n  }\n}\n\n```\n\n\n**How to call dart from Javascript**\n\nYou can add a channel on `JavascriptRuntime` objects to receive calls from the Javascript engine:\n\nIn the dart side:\n\n```dart\njavascriptRuntime.onMessage('someChannelName', (dynamic args) {\n     print(args);\n});\n```\n\n\nNow, if your javascript code calls `sendMessage('someChannelName', JSON.stringify([1,2,3]);` the above dart function provided as the second argument will be called\nwith a List containing 1, 2, 3 as it elements.\n\n\n## Alternatives (and also why we think our library is better)\n\nThere were another packages which provides alternatives to evaluate javascript in flutter projects:\n\n### https://pub.dev/packages/flutter_liquidcore\n\nGood, is based on https://github.com/LiquidPlayer/LiquidCore\n\nIt is based on V8 engine so the exectuable library is huge (20Mb). So the final app will be huge too.\n\n\n### https://pub.dev/packages/interactive_webview\n\nAllows to evaluate javascript in a hidden webview. Does not add weight to size of the app, but a webview means a entire browser is in memory just to evaluate javascript code. So we think an embeddable engine is a way better solution.\n\n### https://pub.dev/packages/jsengine\n\nBased on jerryscript which is slower than quickjs. The jsengine package does not have implementation to iOS.\n\n### https://pub.dev/packages/flutter_jscore\n\nUses Javascript Core in Android and IOS. We got the JavascriptCore bindings from this amazing package. But, by\ndefault we provides QuickJS as the javascript runtime on Android because it provides a smaller footprint. Also \nour library adds support to ConsoleLog, SetTimeout, Xhr, Fetch and Promises to be used in the scripts evaluation \nand allows your Flutter app to provide dartFunctions as channels through `onMessage` function to be called inside\nyour javascript code.\n\n\n### https://pub.dev/packages/flutter_qjs\n\nAmazing package which does implement the javascript engine using quickjs through Dart ffi.\nThe only difference is it uses quickjs also on IOS devices, which we understand would be problematic to pass Apple Store Review process. In the flutter_js 0.4.0 version, which we\nadded support to Desktop and also improved the Dart/Js integration, we borrowed the C function bindings and Dart/JS conversions and integrations from the flutter_qjs source code. We just adapted it to support xhr, fetch and to keep the same interface provided on flutter_js through the class JavascriptRuntime.\n\n\n## Small Apk size\n\nA hello world flutter app, according flutter docs has 4.2 Mb or 4.6 Mb in size.\n\nhttps://flutter.dev/docs/perf/app-size#android\n\n\nBellow you can see the apk sizes of the `example app` generated with *flutter_js*:\n\n```bash\n\n|master ✓| → flutter build apk --split-per-abi\n\n✓ Built build/app/outputs/apk/release/app-armeabi-v7a-release.apk (5.4MB).\n✓ Built build/app/outputs/apk/release/app-arm64-v8a-release.apk (5.9MB).\n✓ Built build/app/outputs/apk/release/app-x86_64-release.apk (6.1MB).\n```\n\n\n## Ajv\n\nWe just added an example of use of the amazing js library [Ajv](https://ajv.js.org/) which allow to bring state of the art json schema validation features\nto the Flutter world. We can see the Ajv examples here: https://github.com/abner/flutter_js/blob/master/example/lib/ajv_example.dart \n\n\nSee bellow the screens we added to the example app:\n\n### IOS\n\n![ios_form](doc/ios_ajv_form.png)\n\n![ios_ajv_result](doc/ios_ajv_result.png)\n\n### Android\n\n![android_form](doc/android_ajv_form.png)\n\n![android_ajv_result](doc/android_ajv_result.png)\n\n\n## MACOS\n\n* To solve `Command Line Tool - Error - xcrun: error: unable to find utility “xcodebuild”, not a developer tool or in PATH`\n\n\u003e sudo xcode-select -s /Applications/Xcode.app/Contents/Developer\n\nIn Catalina with XCode 12 i needed to install ruby 2.7.2 in order to install `cocoapods` (Also needed to Flutter on IOS). So i installed `brew`and after `rbenv`.\n\nTo enable http calls, add this to your files: \n\n* DebugProfile.entitlements\n```plist\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003ecom.apple.security.app-sandbox\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003ecom.apple.security.cs.allow-jit\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003ecom.apple.security.network.client\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003ecom.apple.security.network.server\u003c/key\u003e\n\t\u003ctrue/\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n\n```\n\n* Release.entitlements\n```plist\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003ecom.apple.security.app-sandbox\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003ecom.apple.security.network.client\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003ecom.apple.security.network.server\u003c/key\u003e\n\t\u003ctrue/\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\n\n## Windows and Linux\n\nThe C wrapper library is hosted on this github repository: https://github.com/abner/quickjs-c-bridge \n\nWe just separated the code to allow build it and in this repository we have only the released shared library, so each application using the flutter_js does not need to keep recompiling it all the time\n\n## QuickJs Android shared libraries\n\nThe library wrapper, both QuickJS and JavascriptCore, are also compiled in a separated repository: https://github.com/fast-development/android-js-runtimes\n\nWith the library being compiled and published to jitpack, applications using the wrappers, through flutter_js does not need to compile the shared library using Android NDK.\n\n\n## Unit Testing javascript evaluation\n\nWe can unit test evaluation of expressions on flutter_js using the desktop platforms (windows, linux and macos).\n\nFor `Windows` and `Linux` you need to build your app Desktop executable first: `flutter build -d windows` or `flutter build -d linux`.\n\nOn Windows, after build your application for the first time, at least, add the path `build\\windows\\runner\\Debug` (the absolute path) to your environment path.\n\nIn powershell, just run `$env:path += \";${pwd}\\build\\windows\\runner\\Debug\"`. Now you can run the test in the command line session where you added the `\\build\\windows\\runner\\Debug` into the path.\n\nFor `Linux` you need to exports an environment variable called `LIBQUICKJSC_TEST_PATH` pointing to `build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so`. eg: `export LIBQUICKJSC_TEST_PATH=\"$PWD/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so\"`\n\n\nTo run the test integrated Visual Studio Code, you will need to setup a launcher to the `.vscode/launch.json` file,\nso you can fill-in the build folder into the `PATH` on Windows and the `LIBQUICKJSC_TEST_PATH` for linux:\n\n```json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"test-with-flutterjs\",\n            \"type\": \"dart\",\n            \"program\": \"test/flutter_js_test.dart\",\n            \"windows\": {\n                \"env\": {\n                    \"PATH\": \"${env:Path};${workspaceFolder}\\\\example\\\\build\\\\windows\\\\runner\\\\Debug\"\n                }\n            },\n            \"linux\": {\n                \"env\": {\n                    \"LIBQUICKJSC_TEST_PATH\": \"${workspaceFolder}/example/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so\"\n                }\n            },\n            \"request\": \"launch\"\n        }\n    ]\n}\n```\n\n\u003e For running unit tests on MacOSx no extra steps are needed.\n","funding_links":["https://github.com/sponsors/abner"],"categories":["Dart","Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabner%2Fflutter_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabner%2Fflutter_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabner%2Fflutter_js/lists"}