dart_eval
0.8.5, released 6 months ago by ethanblake.xyz
A flexible Dart bytecode compiler and interpreter for dynamic execution and code push.
What it does
Compiles and interprets Dart bytecode at runtime, allowing dynamic code execution and hot updating (code push) for AOT-compiled Dart and Flutter apps. It includes automated interop and binding generation systems so native Dart code can be used inside the interpreter and vice versa.
AI-written summary of version 0.8.5, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need code push capabilities for Flutter AOT apps.
- You want to execute arbitrary or user-submitted Dart code safely via a sandbox with granular permissions.
Skip it when
- You require 100% of the standard library and all advanced language features immediately supported out of the box.
- Maximum execution performance is critical, as interpreted bytecode is slower than native AOT/JIT execution.
Strengths
- Enables code push and dynamic execution in AOT Flutter apps.
- Automated interop and binding generator for seamlessly using native classes in the interpreter.
- Built-in sandboxing and permission system for secure execution.
Weaknesses
- Does not yet implement certain language features (e.g., generators, extension methods) and parts of the standard library.
- Runtime performance of interpreted code is lower than native execution.
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 13
Add dart_eval to dependencies, optionally use the CLI for pre-compiling EVC bytecode or generating interop bindings via eval_annotation.
import 'package:dart_eval/dart_eval.dart';
void main() {
print(eval('2 + 2')); // -> 4
}Alternatives
Packages that do the same job and could replace dart_eval.
- shorebird_code_push
If you need full native binary updates via a hosted code push service rather than bytecode interpretation.
89Compare
Works with
Packages commonly used together with dart_eval: ones it builds on, ones built on it, and its own family.
- analyzerdart_eval depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamldart_eval depends on itA Dart library for parsing YAML documents into Dart data structures.
- pub_semverdart_eval depends on itVersions and version constraints implementing pub's versioning policy.
- globdart_eval depends on itA file and directory globbing library that supports Bash-style path matching and listing.
- package_configdart_eval depends on itRead and write Dart package configuration files.
- dart_styledart_eval depends on itProvides an API and CLI to format Dart source code automatically.
- pubspec_parsedart_eval depends on itParse pubspec.yaml files with a type‑safe API and detailed error reporting.
- json_annotationdart_eval depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.