jsf library
JSF provides a QuickJS-backed JavaScript runtime for Flutter native platforms and a browser-runtime implementation for Flutter Web.
The main entry point is JsRuntime. Use JsRuntime.eval for one-shot Dart values and JsRuntime.evalValue when JavaScript object identity or handle-based interop must be preserved.
Classes
- JsArrayHole
- Sentinel representing a missing element in a sparse JavaScript array.
- JsErrorDetails
- Structured details extracted from a JavaScript or Dart callback error.
- JsRegExp
-
Serializable representation of a JavaScript
RegExp. - JsRuntime
- Native QuickJS runtime used on Android, iOS, macOS, Linux, Windows, and OHOS.
- JsRuntimeOptions
- Configuration applied when creating a JsRuntime.
- JsTypedArray
- Serializable representation of a JavaScript TypedArray.
- JsUndefined
-
Sentinel representing JavaScript
undefined. - JsUnsupportedValue
- Marker returned when a JavaScript value cannot be represented as a Dart value snapshot.
- JsValue
- Handle to a JavaScript value owned by, or borrowed from, a JsRuntime.
- Runtime
- An abstract class that defines the interface for a runtime environment capable of evaluating and executing code, as well as managing resources.
Constants
- jsArrayHole → const JsArrayHole
- Sentinel used when a JavaScript sparse array contains a hole.
- jsUndefined → const JsUndefined
-
Sentinel used when a Dart value represents JavaScript
undefined.
Functions
-
decodeJsTransferValue(
Object? value) → Object? - Decodes a JSF transfer-schema value into Dart objects.
-
disposeRuntimeValues(
Pointer< JSFRuntime> runtime) → void -
encodeJsTransferValue(
Object? value) → Object? - Encodes a Dart object into JSF's transfer schema.
-
toJavaScriptLiteral(
Object? value) → String -
Encodes
valueas a JavaScript-compatible JSON transfer literal. -
wrapBorrowedJsValue(
NativeJsfBindings bindings, Pointer< JSFRuntime> runtime, Pointer<JSFValue> pointer, {Object? owner}) → JsValue -
wrapJsValue(
NativeJsfBindings bindings, Pointer< JSFRuntime> runtime, Pointer<JSFValue> pointer, {Object? owner}) → JsValue
Exceptions / Errors
- JsException
- Exception thrown when JavaScript evaluation, conversion, or interop fails.