getRequiredResolvedUnit method

Future<ResolvedUnitResult> getRequiredResolvedUnit(
  1. String filePath
)

Resolves the unit at filePath, throwing a StateError if resolution fails or the file does not exist.

Implementation

Future<ResolvedUnitResult> getRequiredResolvedUnit(String filePath) async {
  final absPath = p.normalize(p.absolute(filePath));
  final unitResult = await getResolvedUnit(absPath);
  if (unitResult == null) {
    throw StateError('Failed to resolve Dart unit for "$filePath"');
  }
  return unitResult;
}