dynamic_modules 0.1.0
dynamic_modules: ^0.1.0 copied to clipboard
Minimal wrapper over the Dart VM's dynamic-module loader. Requires a Flutter engine built with --dart-dynamic-modules; it will not compile against a stock SDK, by design.
dynamic_modules #
A minimal wrapper over the Dart VM's dynamic-module loader, used by the iOS CodePush path.
This will not compile against a stock Flutter SDK, by design. It requires
an engine built with --dart-dynamic-modules.
The name is load-bearing #
loadDynamicModule lives in dart:_internal, which ordinary app code cannot
import. The Dart front end allows exactly three importers, hardcoded in
pkg/kernel/lib/target/targets.dart:
bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) =>
importer.isScheme("dart") ||
(importer.isScheme("package") &&
(importer.path.startsWith("dart_internal/") ||
importer.path.startsWith("dynamic_modules/")));
The check is on the package name in the import URI and nothing else. A package
named dynamic_modules is allowed to do this; one named anything else is not.
That is the entire reason this package exists under this name.
Mirrors the upstream, SDK-internal pkg/dynamic_modules.