dart_eval library
A library providing a Dart bytecode compiler and interpreter.
Classes
Properties
- globalRuntime ↔ Runtime?
-
The global runtime instance to be used for overrides
getter/setter pair
-
runtimeOverrides
↔ Map<
String, OverrideSpec> ? -
Mapping of runtime overrides, which can be used to dynamically swap
implementations of functions at runtime by a unique ID
getter/setter pair
- runtimeOverrideVersion ↔ Version?
-
The current semver Version of your app. Overriden functions can specify
a version constraint in their @RuntimeOverride annotation which will be
checked against this version to determine if the override should apply.
getter/setter pair
Functions
-
eval(
String source, {String function = 'main', List args = const [], List< EvalPlugin> plugins = const [], List<Permission> permissions = const [], String? outputFile}) → dynamic -
Evaluate the Dart
source
code. If the source is a raw expression such as "2 + 2" it will be evaluated directly and the result will be returned; otherwise, the functionfunction
will be called with arguments specified byargs
. You can useplugins
to configure bridge classes andpermissions
to grant permissions to the runtime. You can also specifyoutputFile
to write the generated EVC bytecode to a file.