You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make {@canonicalFor library_name.DeclName} not use library name. #4257
The canonicalFor directive is possibly the last part of the Dart SDK that relies on giving a library a name. Everything else has at least a different alternative for unnamed libraries.
There is no other reason to give a library a name, and using library names is generally considered "so last decade!", so it irks when you have to go write a library name just to use canonicalFor.
The canonicalFor directive should introduce a different way to refer to a library.
I'd recommend:
{@canonicalFor DeclName}, where DeclName denotes the declaration actually exported by this library by that name. That should be unique and always what you want.
{@canonicalFor package:whatnot/entry.dart DeclName} or * {@canonicalFor package:whatnot/entry.dart#DeclName} if you want to denote the library. URIs is how you denote a library. But really shouldn't be necessary, the first option should always be the right one.
changed the title [-]Make `{@canonicalFor library_name:DeclName}` not use library name.[/-][+]Make `{@canonicalFor library_name.DeclName}` not use library name.[/+]on Jun 16, 2026
Activity
[-]Make `{@canonicalFor library_name:DeclName}` not use library name.[/-][+]Make `{@canonicalFor library_name.DeclName}` not use library name.[/+]