== Why is this an issue?

In Dart there's a possibility to annotate a library. Currently, it is allowed to put such annotations to any library-level directive. However, it is highly recommended to attach such annotations to the `library` directive to make the intention clear and not make some accidental mistake.

== How to fix it
Add the library directive before the annotation.

=== Code examples

==== Noncompliant code example

[source,dart,diff-id=1,diff-type=noncompliant]
----
@pragma('dart2js:late:trust') // Noncompliant

import 'some_import';
----

==== Compliant solution

[source,dart,diff-id=1,diff-type=compliant]
----
@pragma('dart2js:late:trust')
library;

import 'some_import';
----

== Resources

=== Documentation

* Dart Docs - https://dart.dev/tools/linter-rules/library_annotations[Dart Linter rule - library_annotations]
* Dart Docs - https://dart.dev/language/libraries#library-directive[Library directive]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

* This annotation should be attached to a library directive.

=== Highlighting

The annotation

'''
== Comments And Links
(visible only on this page)

endif::env-github,rspecator-view[]
