flutter_js_runtime 1.0.1
flutter_js_runtime: ^1.0.1 copied to clipboard
Run JavaScript in Flutter apps. Uses QuickJS on Android, Windows and Linux, and JavaScriptCore on iOS and macOS.
1.0.1 #
Bug fixes only; no API changes. Issue numbers refer to flutter_js.
fetch / XMLHttpRequest
- Response bodies are passed as data. Bodies containing
`,\or${...}broke the request or ran as JavaScript (#135, #80). - The real HTTP status is reported instead of always
200 OK(#175), and response headers are available (getResponseHeader()returnsnullfor a missing header). - Network failures reject with a
TypeErrorand non-UTF-8 bodies no longer hang the request (#137). POST/PUT/PATCHwithout a body no longer sendnull. Other methods (OPTIONS, ...) and non-string header values or bodies are sent instead of hanging. Binary bodies are not supported and fail withonerror.
Runtime
dispose()cancels the runtime's timers and frees it; before, they kept running and leaked the runtime (#168, #37). It is safe to call twice, right after creation, and inside anonMessagehandler. Work still pending is dropped.- Fixed memory leaks in
evaluate(#168): on Android, Windows and Linux for every call, and on iOS and macOS for calls that return a number or a string. setTimeoutworks with delays such as10.5or"10"(#62).handlePromiseno longer overwrites a global namedidx.
iOS, macOS (JavaScriptCore)
- Fixed crashes:
sendMessagecalled with fewer than two arguments, and using a runtime afterdispose()(now aStateError). - With several runtimes, each one receives its own messages (
console.log,setTimeout,fetch). - A failing async
onMessagehandler rejects the JavaScript promise.convertValuehandlesNaN,Infinityand exponent notation.
Android, Windows, Linux (QuickJS)
evaluatesetsisPromise(#155) and usessourceUrlin error stacks (#146).convertValuereturns the value instead oftrue(#101).
1.0.0 #
- Added Swift Package Manager support on iOS and macOS. CocoaPods keeps working.
- Android: migrated the plugin to built-in Kotlin (Android Gradle Plugin 9). Fixes the build failure and the "plugins that apply Kotlin Gradle Plugin" warning in apps created with current Flutter versions.
- Requires Flutter 3.44 / Dart 3.12 or newer. Use 0.9.x on older Flutter versions.
- Minimum deployment targets raised to iOS 13.0 and macOS 10.15 (the minimums of Flutter 3.44).
- iOS: the plugin is now Swift-only. The Objective-C wrapper and the
SwiftFlutterJsRuntimePluginclass were removed; the plugin class isFlutterJsRuntimePlugin. - Example app updated to the current Flutter Android and Xcode project setup, with an integration test.
0.9.1 #
- Replaced deprecated
Pointer.elementAt. Requires Dart 3.3 / Flutter 3.19+.
0.9.0 #
First release as flutter_js_runtime, based on flutter_js 0.8.7.
- Renamed package. Change the dependency and imports to
package:flutter_js_runtime/; the API is the same. - New import
package:flutter_js_runtime/flutter_js_runtime.dart(flutter_js.dartstill works). - Renamed method channel and plugin class to avoid clashes with flutter_js.
- Fixed
enableFetch()asset path.
For earlier versions, see the flutter_js changelog.