Skip to content

Cross-link extensions on class where they apply #2021

Closed
@munificent

Description

@munificent

Issue #2001 is about documenting extensions themselves at the point they are defined. That's canonical "place" for an extension's docs.

One concern some users have is that users will run into this scenario.

  1. They see some code like foo.bar(). They want to know what bar() is.
  2. They know foo is a Foo, so they look up the API docs for Foo.
  3. No bar().

What they don't realize is that bar() is an extension method defined elsewhere. In the general case, this can't be solved. Users can define extensions on types outside of their own packages, even on core library types or non-class types that have no docs.

But in many cases, the type the extension applies to is a class in the same package where the extension itself is defined. In those cases, it would be nice if the dartdoc for that class could cross-link to the relevant extensions. For example, the C# docs for the IEnumerable interface have a section for extension methods the .NET core library defines on that type.

cc @mit-mit

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failurescustomer-flutterIssues originating from important to Fluttertype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions