>>>
bool _hasLibraryDirective(String code) =>
    parseDirectives(code, suppressErrors: true)
        .directives.any((d) => d is LibraryDirective);
<<<
### TODO(rnystrom): I think the before was better here.
bool _hasLibraryDirective(String code) => parseDirectives(
  code,
  suppressErrors: true,
).directives.any((d) => d is LibraryDirective);