resolveFile2 function

Future<SomeResolvedUnitResult> resolveFile2({
  1. required String path,
  2. ResourceProvider? resourceProvider,
})

Return the result of resolving the file at the given path.

If a resourceProvider is given, it will be used to access the file system.

Note that if more than one file is going to be resolved then this function is inefficient. Clients should instead use AnalysisContextCollection to create one or more contexts and use those contexts to resolve the files.

Implementation

Future<SomeResolvedUnitResult> resolveFile2(
    {required String path, ResourceProvider? resourceProvider}) async {
  AnalysisContext context =
      _createAnalysisContext(path: path, resourceProvider: resourceProvider);
  return await context.currentSession.getResolvedUnit(path);
}