Source Document: https://dart.dev/guides/language/specifications/DartLangSpec-v2.2.pdf
Page: 166
There is a definition for the rule libraryDefinition but it isn't referenced anywhere so it isn't defined where these rules can appear.
Thanks for reporting this! However, <libraryDefinition> is a non-terminal that derives a library, that is, this is the top level non-terminal (also known as the 'start symbol' of the grammar), so it's a quite typical situation that such a non-terminal doesn't occur on any right hand sides in the grammar. There is one more start symbol, <partDeclaration>, and it also doesn't occur on any right-hand sides. So I'll close this issue noting that it is actually specified as intended.
PS: Note that the bleeding edge specification is a better place to look for the current rules: https://spec.dart.dev/DartLangSpecDraft.pdf, https://github.com/dart-lang/language/blob/master/specification/dartLangSpec.tex.
Thanks, can I ask how is it defined as a "top level non-terminal"?
That was never described explicitly, but it's a reasonable thing to have. I created https://github.com/dart-lang/language/pull/773 to fix that.
Clarification now landed as https://github.com/dart-lang/language/commit/8da3a0e8f4c9bc55f739b7018646305d79330a3b.