loadExternalLibrary function

FutureOr<ExternalLibrary> loadExternalLibrary(
  1. ExternalLibraryLoaderConfig config
)

Load the ExternalLibrary, with the following cases in mind:

  1. When flutter run, or when a real app is bundled.
  2. When running Flutter widget tests.
  3. When dart test, dart run, dart compile exe, etc.

Implementation

FutureOr<ExternalLibrary> loadExternalLibrary(
  ExternalLibraryLoaderConfig config,
) async {
  final ioDirectory = config.ioDirectory;
  return loadExternalLibraryRaw(
    nativeLibDirWhenNonPackaged: ioDirectory == null
        ? null
        : Directory.current.uri.resolve(ioDirectory),
    stem: config.stem,
  );
}