getImportDirective function

ImportDirective getImportDirective(
  1. CompilationUnit unit
)

Returns the first ImportDirective, failing the test if absent.

Implementation

ImportDirective getImportDirective(CompilationUnit unit) {
  final importDirective = findImportDirective(unit);
  if (importDirective == null) {
    fail('Could not find any import directive definition');
  }

  return importDirective;
}