├── .github
└── FUNDING.yml
├── .gitignore
├── .metadata
├── .vscode
├── launch.json
└── settings.json
├── CHANGELOG.md
├── FIXED_RESOURCE.txt
├── LICENSE
├── README.md
├── android
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── kotlin
│ └── io
│ └── abner
│ └── flutter_js
│ ├── FlutterJsPlugin.kt
│ ├── JSEngine.kt
│ └── flutter_js
│ └── FlutterJsPlugin.kt
├── assets
└── js
│ └── fetch.js
├── doc
├── android_ajv_form.png
├── android_ajv_result.png
├── flutter_js.png
├── ios_ajv_form.png
├── ios_ajv_result.png
├── ios_capture.png
├── ios_source.html
└── macos-capture.png
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── io
│ │ │ │ │ └── abner
│ │ │ │ │ └── flutter_js_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── assets
│ ├── js.ico
│ └── js
│ │ └── ajv.js
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ ├── ajv_example.dart
│ ├── ajv_result_screen.dart
│ ├── api_call.dart
│ ├── example.dart
│ ├── form.dart
│ ├── json_viewer.dart
│ └── main.dart
├── linux
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ │ └── CMakeLists.txt
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── macos
│ ├── .gitignore
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ └── Flutter-Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ │ ├── Base.lproj
│ │ └── MainMenu.xib
│ │ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── flutter_js_test.dart
└── windows
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ └── CMakeLists.txt
│ └── runner
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── resources
│ └── app_icon.ico
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── ios.mp4
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── Console.swift
│ ├── FlutterJsPlugin.h
│ ├── FlutterJsPlugin.m
│ ├── Global.swift
│ ├── JSContextFoundation.swift
│ ├── JSInsert.swift
│ └── SwiftFlutterJsPlugin.swift
└── flutter_js.podspec
├── lib
├── extensions
│ ├── fetch.dart
│ ├── handle_promises.dart
│ └── xhr.dart
├── flutter_js.dart
├── javascript_runtime.dart
├── javascriptcore
│ ├── binding
│ │ ├── js_base.dart
│ │ ├── js_context_ref.dart
│ │ ├── js_global_context_ref.dart
│ │ ├── js_object_ref.dart
│ │ ├── js_string_ref.dart
│ │ ├── js_typed_array.dart
│ │ ├── js_value_ref.dart
│ │ └── jsc_ffi.dart
│ ├── flutter_jscore.dart
│ ├── jscore
│ │ ├── js_class.dart
│ │ ├── js_context.dart
│ │ ├── js_context_group.dart
│ │ ├── js_object.dart
│ │ ├── js_property_name_accumulator.dart
│ │ ├── js_property_name_array.dart
│ │ ├── js_string.dart
│ │ └── js_value.dart
│ ├── jscore_bindings.dart
│ └── jscore_runtime.dart
├── js_eval_result.dart
├── quickjs-sync-server
│ └── quickjs_oasis_jsbridge.dart
└── quickjs
│ ├── ffi.dart
│ ├── isolate.dart
│ ├── object.dart
│ ├── qjs_typedefs.dart
│ ├── quickjs_runtime.dart
│ ├── quickjs_runtime2.dart
│ ├── utf8_null_terminated.dart
│ └── wrapper.dart
├── linux
├── CMakeLists.txt
├── flutter_js_plugin.cc
├── include
│ └── flutter_js
│ │ └── flutter_js_plugin.h
└── shared
│ └── libquickjs_c_bridge_plugin.so
├── macos
├── Classes
│ └── FlutterJsPlugin.swift
└── flutter_js.podspec
├── pubspec.lock
├── pubspec.yaml
├── test
└── flutter_js_test.dart
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter_js_plugin.cpp
├── include
└── flutter_js
│ └── flutter_js_plugin.h
└── shared
└── quickjs_c_bridge.dll
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: abner
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # Visual Studio Code related
20 | .classpath
21 | .project
22 | .settings/
23 | .vscode/*
24 | !.vscode/settings.json
25 | !.vscode/tasks.json
26 | !.vscode/launch.json
27 | !.vscode/extensions.json
28 | !.vscode/*.code-snippets
29 |
30 | # packages file containing multi-root paths
31 | .packages.generated
32 |
33 | # Flutter/Dart/Pub related
34 | **/doc/api/
35 | .dart_tool/
36 | .flutter-plugins
37 | .flutter-plugins-dependencies
38 | **/generated_plugin_registrant.dart
39 | .packages
40 | .pub-cache/
41 | .pub/
42 | build/
43 | linked_*.ds
44 | unlinked.ds
45 | unlinked_spec.ds
46 |
47 | # Android related
48 | **/android/**/gradle-wrapper.jar
49 | .gradle/
50 | **/android/captures/
51 | **/android/gradlew
52 | **/android/gradlew.bat
53 | **/android/local.properties
54 | **/android/**/GeneratedPluginRegistrant.java
55 | **/android/key.properties
56 | *.keystore
57 | *.jks
58 |
59 | # iOS/XCode related
60 | **/ios/**/*.mode1v3
61 | **/ios/**/*.mode2v3
62 | **/ios/**/*.moved-aside
63 | **/ios/**/*.pbxuser
64 | **/ios/**/*.perspectivev3
65 | **/ios/**/*sync/
66 | **/ios/**/.sconsign.dblite
67 | **/ios/**/.tags*
68 | **/ios/**/.vagrant/
69 | **/ios/**/DerivedData/
70 | **/ios/**/Icon?
71 | **/ios/**/Pods/
72 | **/ios/**/.symlinks/
73 | **/ios/**/profile
74 | **/ios/**/xcuserdata
75 | **/ios/.generated/
76 | **/ios/Flutter/.last_build_id
77 | **/ios/Flutter/App.framework
78 | **/ios/Flutter/Flutter.framework
79 | **/ios/Flutter/Flutter.podspec
80 | **/ios/Flutter/Generated.xcconfig
81 | **/ios/Flutter/ephemeral
82 | **/ios/Flutter/app.flx
83 | **/ios/Flutter/app.zip
84 | **/ios/Flutter/flutter_assets/
85 | **/ios/Flutter/flutter_export_environment.sh
86 | **/ios/ServiceDefinitions.json
87 | **/ios/Runner/GeneratedPluginRegistrant.*
88 |
89 | # macOS
90 | **/Flutter/ephemeral/
91 | **/Pods/
92 | **/macos/Flutter/GeneratedPluginRegistrant.swift
93 | **/macos/Flutter/ephemeral
94 | **/xcuserdata/
95 |
96 | # Windows
97 | **/windows/flutter/generated_plugin_registrant.cc
98 | **/windows/flutter/generated_plugin_registrant.h
99 | **/windows/flutter/generated_plugins.cmake
100 |
101 | # Linux
102 | **/linux/flutter/generated_plugin_registrant.cc
103 | **/linux/flutter/generated_plugin_registrant.h
104 | **/linux/flutter/generated_plugins.cmake
105 |
106 | # Coverage
107 | coverage/
108 |
109 | # Symbols
110 | app.*.symbols
111 |
112 | # Obfuscation related
113 | app.*.map.json
114 |
115 | # Exceptions to above rules.
116 | !**/ios/**/default.mode1v3
117 | !**/ios/**/default.mode2v3
118 | !**/ios/**/default.pbxuser
119 | !**/ios/**/default.perspectivev3
120 |
121 | # Android Studio will place build artifacts here
122 | /android/app/debug
123 | /android/app/profile
124 | /android/app/release
125 | .cxx/
126 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "flutter_js",
9 | "request": "launch",
10 | "type": "dart",
11 | "args": [
12 | "--verbose"
13 | ],
14 | "program": "example/lib/main.dart"
15 | },
16 | {
17 | "name": "example",
18 | "cwd": "example",
19 | "request": "launch",
20 | "type": "dart",
21 | "args": [
22 | "--verbose"
23 | ]
24 | },
25 | {
26 | "name": "packages",
27 | "cwd": "packages",
28 | "request": "launch",
29 | "type": "dart"
30 | },
31 | {
32 | "name": "test-with-flutterjs",
33 | "type": "dart",
34 | "program": "test/flutter_js_test.dart",
35 | "windows": {
36 | "env": {
37 | "PATH": "${env:Path};${workspaceFolder}\\example\\build\\windows\\runner\\Debug"
38 | }
39 | },
40 | "linux": {
41 | "env": {
42 | "LIBQUICKJSC_TEST_PATH": "${workspaceFolder}/example/build/linux/debug/bundle/lib/libquickjs_c_bridge_plugin.so"
43 | }
44 | },
45 | "request": "launch"
46 | }
47 | ]
48 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.associations": {
3 | "future": "cpp"
4 | }
5 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 0.8.1
2 |
3 | - fix ffi loading of JavascriptCore which failed to resolve relative path 'JavaScriptCore.framework/JavaScriptCore' in
4 | MacOS and iOS, since Flutter version 3.22.0
5 |
6 | # 0.8.0
7 |
8 | - upgrade http dependency to ^1.0.0
9 |
10 | # 0.7.2
11 | - upgraded quickjs code (to allow set timeout and set maxMemory) in preparation for further improvements
12 | - reduced the json output in the example app
13 |
14 | # 0.7.1
15 | - async callback for JSC runtime
16 | - upgraded jsc core in example app
17 |
18 | # 0.7.0
19 | - **Breaking**: require dart 3.0 and Flutter 3 and above
20 | - now supports Flutter 3.10 and Dart 3.0
21 | # 0.6.0
22 |
23 | - **Breaking**: require dart 2.17
24 | - **Breaking**: bump `package:ffi` to `2.0.0`
25 |
26 | # 0.5.1
27 |
28 | - Remove deprecated jCenter android repository in favor of mavenCentral
29 |
30 | # 0.5.0+6
31 |
32 | - Accepted PR [66](https://github.com/abner/flutter_js/pull/66) to return the stack
33 | trace into the error message from javascriptcore
34 | - Accepted PR [#74] which prints multiples args passed into console.log
35 | - Updated example application with new Flutter version (2.10.1)
36 |
37 | # 0.5.0+5
38 |
39 | - Accept PR [67](https://github.com/abner/flutter_js/pull/67) to adjust channelFunction to return the function result when using JavascriptCore on Android
40 |
41 | # 0.5.0+4
42 |
43 | - Accept PR [54](https://github.com/abner/flutter_js/pull/54) to adjust channelFunction to return the function result
44 |
45 | # 0.5.0+3
46 |
47 | - Fix the network call bug: https://github.com/abner/flutter_js/pull/57
48 |
49 | # 0.5.0+2
50 |
51 | - Fix the minimal stack size for 1MB for QuickJS Runtime
52 |
53 | # 0.5.0+1
54 |
55 | - Fix the handle_promises when the promise result is not a string
56 |
57 | # 0.5.0+0
58 |
59 | - Fixes issue relative to build on Dart 2.13 (issues #41 and #42)
60 |
61 | # 0.4.0+6
62 |
63 | - Fix executePendingJobs (wasn't dispatching in the most current version)
64 |
65 | # 0.4.0+5
66 |
67 | - Removed console.log from fetch.js
68 |
69 | # 0.4.0+4
70 |
71 | - Fixed issue on xhr requests - wasn't passing headers to the requests
72 |
73 | # 0.4.0+3
74 |
75 | - Fixed dynamic library load for tests
76 | - Added info about tests into the [README.md](README.md)
77 |
78 | # 0.4.0+2
79 |
80 | - Updated README.md with information about github repository containing the C bridge used on
81 | Windows and Linux
82 |
83 | # 0.4.0+1
84 |
85 | - Updated README.md
86 |
87 | # 0.4.0+0
88 |
89 | - Added support to windows, macos and linux platforms
90 | - Fixed fetch error
91 | - Improved the channels/dart callback integration
92 |
93 | # 0.3.0+0
94 |
95 | - Null-safety migration
96 |
97 | # 0.2.4+0
98 |
99 | - Updated ffi, http dependencies
100 | - Upgraded code for compatibility with ffi 1.0.0
101 |
102 | # 0.2.3+0
103 |
104 | - Updated QuickJS engine to version 2020-11-08
105 | - Fix fetch
106 |
107 | # 0.2.2+0
108 |
109 | - Updated QuickJS engine to version 2020-09-06
110 |
111 | # 0.2.1+0
112 |
113 | - Updated to use QuickJS through Dart ffi instead of Platform Channel
114 |
115 | # 0.2.0+0
116 |
117 | - Updated to use QuickJS through PlatformChannel on Android (with this change, Android apk added size will return to be minimal )
118 | - Change QuickJS integration to call Android platform in a sync way through http
119 | - Added option to use JavascriptCore on Android
120 |
121 | # 0.1.0+2
122 |
123 | - Small fixes in the documentation on README.md
124 |
125 | # 0.1.0+1
126 |
127 | - Add example of onMessage (bridge which allow javascript code to call Dart)
128 | in the README.md
129 |
130 | # 0.1.0+0
131 |
132 | - Changed to use Dart FFI to call the Javascript Runtimes: QuickJS by Default in Android and JavascriptCore in iOS
133 |
134 | # 0.0.3+1
135 |
136 | - Updated to use a new version of oasis-jsbridge-android which brings _quickjs_ (js engine for Android)
137 | upgraded to the latest version (currently 2020-07-05)
138 |
139 | # 0.0.2+1
140 |
141 | - Upgraded to use [oasis-jsbridge-android](https://github.com/p7s1digital/oasis-jsbridge-android) library under the hood
142 |
143 | # 0.0.1+2
144 |
145 | - Fixed a typo in the FlutterJsPlugin.kt class
146 |
147 | # 0.0.1+1
148 |
149 | - Initial version only provides a very simple api which allow to init the javascript engine and evaluate javascript expressions and get the result as String.
150 |
--------------------------------------------------------------------------------
/FIXED_RESOURCE.txt:
--------------------------------------------------------------------------------
1 | HTTP CALL WORKED OK! File returned from https://raw.githubusercontent.com/abner/flutter_js/master/FIXED_RESOURCE.txt
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Ábner Oliveira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/android/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.6.0)
2 |
3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -DANDROID_STL=c++_static -DANDROID_TOOLCHAIN=clang -DDEBUGGER_SERVER_PORT=${DEBUGGER_SERVER_PORT}")
4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQUICKJS")
5 | include_directories(
6 | src/main/c/quickjs
7 | )
8 | add_library( fastdev_quickjs_runtime
9 |
10 | # Sets the library as a shared library.
11 | SHARED
12 |
13 | # Provides a relative path to your source file(s).
14 | src/main/c/libfastdev_quickjs_runtime.cpp
15 |
16 | src/main/c/quickjs/cutils.c
17 | src/main/c/quickjs/libregexp.c
18 | src/main/c/quickjs/libunicode.c
19 | src/main/c/quickjs/quickjs.c
20 | )
21 |
22 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCONFIG_VERSION=\\\"2020-11-08\\\"")
23 |
24 | find_library(log-lib log)
25 | target_link_libraries(fastdev_quickjs_runtime ${log-lib})
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'io.abner.flutter_js'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.7.20'
6 | repositories {
7 | google()
8 | mavenCentral()
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:7.3.1'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | }
15 | }
16 |
17 | rootProject.allprojects {
18 | repositories {
19 | google()
20 | mavenCentral()
21 | maven { url 'https://jitpack.io' }
22 | }
23 | }
24 |
25 | apply plugin: 'com.android.library'
26 | apply plugin: 'kotlin-android'
27 |
28 | android {
29 | compileSdkVersion 34
30 |
31 | namespace "io.abner.flutter_js"
32 |
33 | kotlinOptions {
34 | jvmTarget = JavaVersion.VERSION_1_8.toString()
35 | }
36 |
37 | // //quickjs C build disabled for now - crashing with SEGV_MAPERR on ARM based devices
38 | // externalNativeBuild {
39 | // // Encapsulates your CMake build configurations.
40 | // cmake {
41 | // // Provides a relative path to your CMake build script.
42 | // path "CMakeLists.txt"
43 | // }
44 | // }
45 |
46 |
47 | sourceSets {
48 | main.java.srcDirs += 'src/main/kotlin'
49 | main.jniLibs.srcDirs = ['jniLibs']
50 | }
51 | defaultConfig {
52 | minSdkVersion 21
53 | ndk {
54 | abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
55 | }
56 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
57 | }
58 | lintOptions {
59 | disable 'InvalidPackage'
60 | }
61 | }
62 |
63 | dependencies {
64 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
65 |
66 | // implementation using platform-channel with oasis jsbridge
67 | // implementation 'com.github.p7s1digital.oasis-jsbridge-android:oasis-jsbridge-quickjs:0.12.0'
68 | // compile group: 'org.nanohttpd', name: 'nanohttpd', version: '2.3.0'
69 |
70 | // for serve library from jitpack repository
71 | implementation "com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-quickjs:0.3.5"
72 | // implementation "com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-jsc:0.1.3"
73 | }
74 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 07 13:01:34 IST 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_js'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/io/abner/flutter_js/JSEngine.kt:
--------------------------------------------------------------------------------
1 | package io.abner.flutter_js
2 |
3 | import android.util.Log
4 | //import de.prosiebensat1digital.oasisjsbridge.*
5 | //import kotlinx.coroutines.Dispatchers
6 | import java.util.*
7 | import java.util.logging.Logger
8 |
9 |
10 | class JSEngine(context: android.content.Context) {
11 |
12 | // private var runtime: JsBridge = JsBridge(JsBridgeConfig.standardConfig())
13 | // private var messageChannelMap = mutableMapOf String>()
14 |
15 | // fun getRuntime(): JsBridge {
16 | // return runtime
17 | // }
18 |
19 | // var runtimeInitialized = false
20 | // val host = "localhost"
21 |
22 | // val port = 0
23 | // init {
24 |
25 | // val errorListener = object : JsBridge.ErrorListener(Dispatchers.Main) {
26 | // override fun onError(error: JsBridgeError) {
27 | // Log.e("MainActivity", error.errorString())
28 | // }
29 | // }
30 | // runtime.registerErrorListener(errorListener)
31 |
32 | // val getUUID = JsValue.fromNativeFunction0(runtime) {
33 | // UUID.randomUUID().toString()
34 | // }.assignToGlobal("FLUTTERJS_getUUID")
35 |
36 | // val sendMessage = JsValue.fromNativeFunction2(runtime) { channelName: String, message: String ->
37 |
38 | // try {
39 | // if (messageChannelMap.containsKey(channelName)) {
40 | // messageChannelMap.getValue(channelName).invoke(message);
41 | // } else {
42 | // Log.i("SendMessage Channel", "Channel ${channelName} wasn't registered!")
43 | // }
44 |
45 | // return@fromNativeFunction2 "$channelName:$message"
46 | // } catch (e: Exception) {
47 | // return@fromNativeFunction2 e.message
48 | // }
49 |
50 | // }.assignToGlobal("FLUTTERJS_sendMessage")
51 |
52 | // runtime.evaluateBlocking(
53 | // """
54 | // var FLUTTERJS_pendingMessages = {};
55 | // function sendMessage(channel, message) {
56 | // var idMessage = FLUTTERJS_getUUID();
57 | // return new Promise((resolve, reject) => {
58 | // FLUTTERJS_pendingMessages[idMessage] = {
59 | // resolve: (v) => { resolve(v); return v;},
60 | // reject: reject
61 | // };
62 | // FLUTTERJS_sendMessage(channel, JSON.stringify({ id: idMessage, message: message }) );
63 | // });
64 | // }
65 | // """.trimIndent(),
66 | // JsonObjectWrapper::class.java
67 | // )
68 | // }
69 |
70 | // fun registerChannel(channelName: String, channelFn: (message: String) -> String) {
71 | // messageChannelMap[channelName] = channelFn
72 | // }
73 |
74 | // fun eval(script: String): JsonObjectWrapper {
75 | // return runtime.evaluateBlocking(script, JsonObjectWrapper::class.java) as JsonObjectWrapper
76 | // }
77 |
78 | // fun release() {
79 | // runtime.release()
80 | // }
81 |
82 | }
--------------------------------------------------------------------------------
/android/src/main/kotlin/io/abner/flutter_js/flutter_js/FlutterJsPlugin.kt:
--------------------------------------------------------------------------------
1 | package io.abner.flutter_js.flutter_js
2 |
3 | import androidx.annotation.NonNull
4 |
5 | import io.flutter.embedding.engine.plugins.FlutterPlugin
6 | import io.flutter.plugin.common.MethodCall
7 | import io.flutter.plugin.common.MethodChannel
8 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler
9 | import io.flutter.plugin.common.MethodChannel.Result
10 |
11 | /** FlutterJsPlugin */
12 | class FlutterJsPlugin: FlutterPlugin, MethodCallHandler {
13 | /// The MethodChannel that will the communication between Flutter and native Android
14 | ///
15 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it
16 | /// when the Flutter Engine is detached from the Activity
17 | private lateinit var channel : MethodChannel
18 |
19 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
20 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "flutter_js")
21 | channel.setMethodCallHandler(this)
22 | }
23 |
24 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
25 | if (call.method == "getPlatformVersion") {
26 | result.success("Android ${android.os.Build.VERSION.RELEASE}")
27 | } else {
28 | result.notImplemented()
29 | }
30 | }
31 |
32 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
33 | channel.setMethodCallHandler(null)
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/assets/js/fetch.js:
--------------------------------------------------------------------------------
1 | function fetch(url, options) {
2 | options = options || {};
3 | return new Promise( (resolve, reject) => {
4 | const request = new XMLHttpRequest();
5 | const keys = [];
6 | const all = [];
7 | const headers = {};
8 |
9 | const response = () => ({
10 | ok: (request.status/100|0) == 2, // 200-299
11 | statusText: request.statusText,
12 | status: request.status,
13 | url: request.responseURL,
14 | text: () => Promise.resolve(request.responseText),
15 | json: () => {
16 | // TODO: review this handle because it may discard \n from json attributes
17 | try {
18 | // console.log('RESPONSE TEXT IN FETCH: ' + request.responseText);
19 | return Promise.resolve(JSON.parse(request.responseText));
20 | } catch (e) {
21 | // console.log('ERROR on fetch parsing JSON: ' + e.message);
22 | return Promise.resolve(request.responseText);
23 | }
24 | },
25 | blob: () => Promise.resolve(new Blob([request.response])),
26 | clone: response,
27 | headers: {
28 | keys: () => keys,
29 | entries: () => all,
30 | get: n => headers[n.toLowerCase()],
31 | has: n => n.toLowerCase() in headers
32 | }
33 | });
34 |
35 | request.open(options.method || 'get', url, true);
36 |
37 | request.onload = () => {
38 | request.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, (m, key, value) => {
39 | keys.push(key = key.toLowerCase());
40 | all.push([key, value]);
41 | headers[key] = headers[key] ? `${headers[key]},${value}` : value;
42 | });
43 | resolve(response());
44 | };
45 |
46 | request.onerror = reject;
47 |
48 | request.withCredentials = options.credentials=='include';
49 |
50 | if (options.headers) {
51 | if (options.headers.constructor.name == 'Object') {
52 | for (const i in options.headers) {
53 | request.setRequestHeader(i, options.headers[i]);
54 | }
55 | } else { // if it is some Headers pollyfill, the way to iterate is through for of
56 | for (const header of options.headers) {
57 | request.setRequestHeader(header[0], header[1]);
58 | }
59 | }
60 | }
61 |
62 | request.send(options.body || null);
63 | });
64 | }
--------------------------------------------------------------------------------
/doc/android_ajv_form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/android_ajv_form.png
--------------------------------------------------------------------------------
/doc/android_ajv_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/android_ajv_result.png
--------------------------------------------------------------------------------
/doc/flutter_js.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/flutter_js.png
--------------------------------------------------------------------------------
/doc/ios_ajv_form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/ios_ajv_form.png
--------------------------------------------------------------------------------
/doc/ios_ajv_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/ios_ajv_result.png
--------------------------------------------------------------------------------
/doc/ios_capture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/ios_capture.png
--------------------------------------------------------------------------------
/doc/ios_source.html:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/doc/macos-capture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/doc/macos-capture.png
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: db747aa1331bd95bc9b3874c842261ca2d302cd5
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_js_example
2 |
3 | Here is a small flutter app showing how to evaluate javascript code inside a flutter app
4 |
5 |
6 | ```dart
7 | import 'package:flutter/material.dart';
8 | import 'dart:async';
9 |
10 | import 'package:flutter/services.dart';
11 | import 'package:flutter_js/flutter_js.dart';
12 |
13 | void main() => runApp(MyApp());
14 |
15 | class MyApp extends StatefulWidget {
16 | @override
17 | _MyAppState createState() => _MyAppState();
18 | }
19 |
20 | class _MyAppState extends State {
21 | String _jsResult = '';
22 | int _idJsEngine = -1;
23 | @override
24 | void initState() {
25 | super.initState();
26 | initJsEngine();
27 | }
28 |
29 | // Platform messages are asynchronous, so we initialize in an async method.
30 | Future initJsEngine() async {
31 |
32 |
33 | try {
34 | _idJsEngine = await FlutterJs.initEngine();
35 | } on PlatformException catch (e) {
36 | print('Failed to init js engine: ${e.details}');
37 | }
38 |
39 | // If the widget was removed from the tree while the asynchronous platform
40 | // message was in flight, we want to discard the reply rather than calling
41 | // setState to update our non-existent appearance.
42 | if (!mounted) return;
43 |
44 |
45 | }
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | return MaterialApp(
50 | home: Scaffold(
51 | appBar: AppBar(
52 | title: const Text('FlutterJS Example'),
53 | ),
54 | body: Center(
55 | child: Column(
56 | mainAxisAlignment: MainAxisAlignment.center,
57 | children: [
58 | Text('JS Evaluate Result: $_jsResult\n'),
59 | SizedBox(height: 20,),
60 | Padding(padding: EdgeInsets.all(10), child: Text('Click on the big JS Yellow Button to evaluate the expression bellow using the flutter_js plugin'),),
61 | Padding(
62 | padding: const EdgeInsets.all(8.0),
63 | child: Text("Math.trunc(Math.random() * 100).toString();", style: TextStyle(fontSize: 12, fontStyle: FontStyle.italic, fontWeight: FontWeight.bold),),
64 | )
65 | ],
66 | ),
67 | ),
68 | floatingActionButton: FloatingActionButton(
69 | backgroundColor: Colors.transparent,
70 | child: Image.asset('assets/js.ico'),
71 | onPressed: () async {
72 | try {
73 | String result = await FlutterJs.evaluate(
74 | "Math.trunc(Math.random() * 100).toString();", _idJsEngine);
75 | setState(() {
76 | _jsResult = result;
77 | });
78 | } on PlatformException catch (e) {
79 | print('ERRO: ${e.details}');
80 | }
81 | },
82 | ),
83 | ),
84 | );
85 | }
86 | }
87 |
88 | ```
89 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 |
15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16 | if (flutterVersionCode == null) {
17 | flutterVersionCode = '1'
18 | }
19 |
20 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
21 | if (flutterVersionName == null) {
22 | flutterVersionName = '1.0'
23 | }
24 |
25 | android {
26 | namespace "io.abner.flutter_js_example"
27 | compileSdkVersion flutter.compileSdkVersion
28 |
29 | ndkVersion "27.0.12077973"
30 |
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = JavaVersion.VERSION_1_8.toString()
39 | }
40 |
41 | sourceSets {
42 | main {
43 | java.srcDirs += 'src/main/kotlin'
44 | jniLibs.srcDirs = ['jniLibs']
45 | }
46 | }
47 |
48 | defaultConfig {
49 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
50 | applicationId "io.abner.flutter_js_example"
51 |
52 | //minSdkVersion flutter.minSdkVersion
53 | minSdkVersion 21
54 | targetSdkVersion flutter.targetSdkVersion
55 | versionCode flutterVersionCode.toInteger()
56 | versionName flutterVersionName
57 |
58 | // externalNativeBuild {
59 | // cmake {
60 | // cppFlags "-std=c++14 -fexceptions -frtti"
61 | // arguments "-DANDROID_ARM_NEON=TRUE",'-DANDROID_STL=c++_shared'
62 | // }
63 | // }
64 |
65 | externalNativeBuild {
66 |
67 | cmake {
68 |
69 | cppFlags ""
70 |
71 | arguments "-DANDROID_STL=c++_shared", "-DANDROID_ARM_NEON=TRUE"
72 |
73 | }
74 |
75 | }
76 | }
77 |
78 | buildTypes {
79 | release {
80 | // TODO: Add your own signing config for the release build.
81 | // Signing with the debug keys for now, so `flutter run --release` works.
82 | signingConfig signingConfigs.debug
83 |
84 | minifyEnabled true
85 | shrinkResources true
86 |
87 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
88 | }
89 | }
90 | }
91 |
92 | flutter {
93 | source '../..'
94 | }
95 |
96 | dependencies {
97 | // implementation "com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-jsc-intl:0.3.5"
98 | implementation "com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-jsc:0.3.5"
99 | }
100 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | #Flutter Wrapper
2 | -keep class io.flutter.app.** { *; }
3 | -keep class io.flutter.plugin.** { *; }
4 | -keep class io.flutter.util.** { *; }
5 | -keep class io.flutter.view.** { *; }
6 | -keep class io.flutter.** { *; }
7 | -keep class io.flutter.plugins.** { *; }
8 | -keep class de.prosiebensat1digital.** { *; }
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/io/abner/flutter_js_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package io.abner.flutter_js_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = '../build'
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(':app')
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M \
2 | --add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
3 | --add-opens=java.base/java.lang=ALL-UNNAMED \
4 | --add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
5 | --add-opens=java.base/java.io=ALL-UNNAMED \
6 | --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
7 |
8 | android.useAndroidX=true
9 | android.enableJetifier=true
10 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Feb 22 21:40:47 GMT 2025
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version "8.7.3" apply false
22 | id "org.jetbrains.kotlin.android" version "2.1.10" apply false
23 | }
24 |
25 | include ":app"
--------------------------------------------------------------------------------
/example/assets/js.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/assets/js.ico
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_js (0.1.0):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `Flutter`)
8 | - flutter_js (from `.symlinks/plugins/flutter_js/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: Flutter
13 | flutter_js:
14 | :path: ".symlinks/plugins/flutter_js/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
18 | flutter_js: 95929d4e146e8ceb1c8e1889d8c2065c5d840076
19 |
20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
21 |
22 | COCOAPODS: 1.12.1
23 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abner/flutter_js/efdae8c40b46cd31a500d4e57be365e029a9ef06/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Js
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_js_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/ajv_result_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_js_example/json_viewer.dart';
5 |
6 | class AjvResultScreen extends StatelessWidget {
7 | const AjvResultScreen(this.jsonString, {super.key, this.notRoot = false});
8 |
9 | final String jsonString;
10 | final bool notRoot;
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return Scaffold(
15 | appBar: AppBar(title: const Text('Ajv Result')),
16 | body: SafeArea(
17 | child: SingleChildScrollView(
18 | //child: JsonViewerWidget(json.decode(jsonString), notRoot: notRoot )
19 | child: JsonViewerRoot(
20 | jsonObj: json.decode(jsonString),
21 | expandDeep: 4,
22 | )),
23 | ));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/example/lib/api_call.dart:
--------------------------------------------------------------------------------
1 | // import 'dart:async';
2 |
3 | // import 'package:flutter_js/flutter_js.dart';
4 |
5 | // // example to show how to an api call can be made and used a Future in dart
6 | // Future getUser() {
7 | // final completer = Completer();
8 | // const code = """
9 | // try {
10 | // const response = await fetch('https://reqres.in/api/users?page=2');
11 | // const body = await response.json();
12 | // if (response.status === 200) {
13 | // sendMessage('onRequestSuccess', JSON.stringify(body));
14 | // } else {
15 | // sendMessage('onRequestFailure', JSON.stringify(body));
16 | // }
17 | // } catch(e) {
18 | // console.log(e.message);
19 | // sendMessage('onError', e.message);
20 | // }
21 | // """;
22 | // final jsRuntime = getJavascriptRuntime();
23 | // jsRuntime.onMessage('onRequestSuccess', completer.complete);
24 | // jsRuntime.onMessage('onRequestFailure', (args) {
25 | // completer.completeError(args);
26 | // });
27 | // jsRuntime.onMessage('onError', (args) {
28 | // completer.completeError(args);
29 | // });
30 | // return completer.future;
31 | // }
32 |
--------------------------------------------------------------------------------
/example/lib/example.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/services.dart';
4 |
5 | class Example {
6 | static const MethodChannel _channel = MethodChannel('example');
7 |
8 | static Future get platformVersion async {
9 | final String version = await _channel.invokeMethod('getPlatformVersion');
10 | return version;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_js/flutter_js.dart';
5 | import 'package:flutter_js_example/ajv_example.dart';
6 |
7 | void main() {
8 | WidgetsFlutterBinding.ensureInitialized();
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatefulWidget {
13 | final GlobalKey scaffoldState = GlobalKey();
14 |
15 | MyApp({super.key});
16 |
17 | @override
18 | _MyAppState createState() => _MyAppState();
19 | }
20 |
21 | class _MyAppState extends State {
22 | @override
23 | Widget build(BuildContext context) {
24 | return const MaterialApp(
25 | home: FlutterJsHomeScreen(),
26 | );
27 | }
28 | }
29 |
30 | class FlutterJsHomeScreen extends StatefulWidget {
31 | const FlutterJsHomeScreen({super.key});
32 |
33 | @override
34 | _FlutterJsHomeScreenState createState() => _FlutterJsHomeScreenState();
35 | }
36 |
37 | class _FlutterJsHomeScreenState extends State {
38 | String _jsResult = '';
39 |
40 | final JavascriptRuntime javascriptRuntime =
41 | getJavascriptRuntime(forceJavascriptCoreOnAndroid: false);
42 |
43 | String? _quickjsVersion;
44 |
45 | Future evalJS() async {
46 | JsEvalResult jsResult = await javascriptRuntime.evaluateAsync(
47 | """
48 | if (typeof MyClass == 'undefined') {
49 | var MyClass = class {
50 | constructor(id) {
51 | this.id = id;
52 | }
53 |
54 | getId() {
55 | return this.id;
56 | }
57 | }
58 | }
59 | async function test() {
60 | var obj = new MyClass(1);
61 | var jsonStringified = JSON.stringify(obj);
62 | var value = Math.trunc(Math.random() * 100).toString();
63 | var asyncResult = await sendMessage("getDataAsync", JSON.stringify({"count": Math.trunc(Math.random() * 10)}));
64 | var err;
65 | try {
66 | await sendMessage("asyncWithError", "{}");
67 | } catch(e) {
68 | err = e.message || e;
69 | }
70 | return {"object": jsonStringified, "expression": value, "asyncResult": asyncResult, "expectedError": err};
71 | }
72 | test();
73 | """,
74 | sourceUrl: 'script.js',
75 | );
76 | javascriptRuntime.executePendingJob();
77 | JsEvalResult asyncResult = await javascriptRuntime.handlePromise(jsResult);
78 | return asyncResult.stringResult;
79 | }
80 |
81 | @override
82 | void initState() {
83 | super.initState();
84 | javascriptRuntime.setInspectable(true);
85 | javascriptRuntime.onMessage('getDataAsync', (args) async {
86 | await Future.delayed(const Duration(seconds: 1));
87 | final int count = args['count'];
88 | Random rnd = Random();
89 | final result =