resolveLibraryAt method

Future<ResolvedLibraryResult> resolveLibraryAt(
  1. Uri uri
)

Implementation

Future<ResolvedLibraryResult> resolveLibraryAt(Uri uri) async {
  assert(FileSystemEntity.isDirectorySync(
      uri.toFilePath(windows: Platform.isWindows)));
  for (final ctx in contexts.contexts) {
    final path = getPath(uri);
    if (_resolvedAsts.containsKey(path)) {
      return _resolvedAsts[path]! as ResolvedLibraryResult;
    }

    final output = await ctx.currentSession.getResolvedLibrary(path)
        as ResolvedLibraryResult;
    return _resolvedAsts[path] = output;
  }

  throw ArgumentError("'uri' could not be resolved (contexts: "
      "${contexts.contexts.map((c) => c.contextRoot.root.toUri()).join(", ")})");
}