DartPackageImporter class

Fetches Dart package: imports through a PackageProvider and loads their sources into an ApolloVM as modules, so the (synchronous) resolver can then resolve them like any other loaded unit.

Because ApolloVM.loadCodeUnit is asynchronous (parsing is async), package fetching cannot happen inside the synchronous ModuleLoader.loadModule; instead call provision as a pre-pass before ApolloVM.resolve / execution.

Constructors

DartPackageImporter(ApolloVM vm, PackageProvider provider, {String language = 'dart'})

Properties

hashCode int
The hash code for this object.
no setterinherited
language String
Language of the modules this importer loads (Dart packages).
final
provider PackageProvider
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vm ApolloVM
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provision() Future<List<ImportDiagnostic>>
Resolves and loads every package: import reachable from the currently loaded modules (transitively), returning any diagnostics (unresolved packages, or sources that ApolloVM's Dart subset can't parse).
toString() String
A string representation of this object.
inherited

Operators

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