resolveFile function Null safety

Future<ResolvedUnitResult?> resolveFile(
  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.

TODO(migration): should not be nullable

Implementation

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