Compiler class

Compiles Dart source code into EVC bytecode, outputting a Program.

To use, call compile or compileSources.

You may define bridge libraries using a combination of defineBridgeClass, defineBridgeTopLevelFunction, and defineBridgeEnum.

Additional sources can be added with addSource.

Implemented types

Constructors

Compiler()

Properties

additionalSources List<DartSource>
List of additional DartSource files to be compiled when compile is run
final
bridgedLibraries List<String>
A list of libraries that have been bridged
no setter
entrypoints List<String>
List of files whose functions should be used as entrypoints. These can be full URIs (e.g. package:foo/main.dart) or just filenames (e.g. main.dart). Adding a file to this list prevents it from being dead-code eliminated.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version String?
The semantic version of the compiled code, for runtime overrides
getter/setter pair

Methods

addPlugin(EvalPlugin plugin) → void
Register a plugin with this registry.
override
addSource(DartSource source) → void
Add a unit source to the list of additional sources which will be compiled alongside the packages specified in compile.
override
compile(Map<String, Map<String, String>> packages) Program
Compile a set of Dart code into a program. Shorthand for compileSources. Code should be specified in a map as such:
compileSources([Iterable<DartSource> sources = const [], bool debugPerf = true]) Program
Compile a unit set of Dart code into a program
compileWriteAndLoad(Map<String, Map<String, String>> packages) Runtime
For testing purposes. Compile code, write it to a byte stream, load it, and run it.
defineBridgeClass(BridgeClassDef classDef) → void
override
defineBridgeClasses(List<BridgeClassDef> classDefs) → void
Define a set of unresolved bridge classes
defineBridgeEnum(BridgeEnumDef enumDef) → void
Define a bridged enum definition to be used when compiling.
override
defineBridgeTopLevelFunction(BridgeFunctionDeclaration function) → void
Define a bridged top-level function declaration.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited