ModuleLoader class

Implemented types

Constructors

ModuleLoader(Environment globalEnvironment, Map<String, String> sources, List<Map<String, LibraryEnum>> bridgedEnumDefinitions, List<Map<String, LibraryClass>> bridgedClases, {D4rt? d4rt, List<Map<String, LibraryFunction>> libraryFunctions = const [], List<Map<String, LibraryVariable>> libraryVariables = const [], List<Map<String, LibraryGetter>> libraryGetters = const [], List<Map<String, LibrarySetter>> librarySetters = const [], List<Map<String, LibraryExtension>> bridgedExtensions = const [], bool collectRegistrationErrors = false, SCompilationUnit parseSourceCallback(String sourceCode, Uri uri)?, String? basePath, bool allowFileSystemImports = false})

Properties

accumulatedRegistrationErrors List<String>
Accumulated registration errors when collectRegistrationErrors is true.
final
allowFileSystemImports bool
DGUB3 (mirrors tom_d4rt DFUB1) — when true, _fetchModuleSource may read a module's source from the filesystem (via _resolveFileSystemUri) if the URI is not already in sources and the resolved file exists. Defaults to false (sandboxed: only preloaded sources and bridged/stdlib modules are visible). Every such read is gated by _checkFileSystemSourceReadPermission.
final
basePath String?
DGUB3 (mirrors tom_d4rt DFUB1) — base directory for resolving relative filesystem imports.
final
bridgedClases List<Map<String, LibraryClass>>
final
bridgedEnumDefinitions List<Map<String, LibraryEnum>>
final
bridgedExtensions List<Map<String, LibraryExtension>>
final
collectRegistrationErrors bool
When true, registration errors are collected instead of thrown.
getter/setter pair
currentLibrary Uri?
The current library URI being executed.
getter/setter pairoverride
d4rt D4rt?
final
globalEnvironment Environment
The global environment shared across all modules.
final
hashCode int
The hash code for this object.
no setterinherited
initialFileSystemLibraryUri Uri?
DGUB3 (mirrors tom_d4rt DFUB1) — the URI the interpreter should treat as the initial library when the root source was supplied inline (no explicit library:) and filesystem imports are enabled.
no setter
libraryFunctions List<Map<String, LibraryFunction>>
final
libraryGetters List<Map<String, LibraryGetter>>
final
librarySetters List<Map<String, LibrarySetter>>
final
libraryVariables List<Map<String, LibraryVariable>>
final
parseSourceCallback SCompilationUnit Function(String sourceCode, Uri uri)?
Callback for parsing source code into an SAstNode tree. When provided, this is used to convert raw source strings into SCompilationUnit nodes. When null, the module loader can only work with pre-parsed AST input.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sources Map<String, String>
final

Methods

checkPermission(dynamic operation) bool
Checks if a permission is granted for the given operation.
override
loadModule(Uri uri, {Set<String>? showNames, Set<String>? hideNames}) → LoadedModule
Loads a module from the given URI.
override
loadModuleInternal(Uri uri, {Set<String>? showNames, Set<String>? hideNames}) LoadedModule
Internal implementation that returns the full LoadedModule with environment.
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