dartdoc icon indicating copy to clipboard operation
dartdoc copied to clipboard

Flutter API docs included libraries missing link to code

Open guidezpl opened this issue 1 year ago • 2 comments

I noticed some libraries included in Flutter don't have a View source code button e.g. https://api.flutter.dev/flutter/dart-ui/Color/lerp.html

image

Is this a limitation or can be worked around?

Screenshot 2024-04-23 at 09 35 34

guidezpl avatar Apr 23 '24 07:04 guidezpl

Yes, it looks like no methods, etc. from dart:ui have a "Show source code" in the top right of the main frame. But methods found in package:flutter do have those links. @goderbauer do you know if this is expected / intentional? Should only package:flutter have such links? Should all packages? Should a short list of packages have those links?

srawlins avatar Apr 23 '24 15:04 srawlins

Ideally, all packages would have source links. We currently seem to only set up source links for the flutter/flutter repository, though, see: https://github.com/flutter/flutter/blob/b0524b354b1593e17f292cb4e78145916a549898/dev/tools/create_api_docs.dart#L570-L575

And after dartdoc is done we do some post-processing on the links here to "fix" them: https://github.com/flutter/flutter/blob/b0524b354b1593e17f292cb4e78145916a549898/dev/tools/create_api_docs.dart#L298

Not sure what we'd have to do to link to source for other packages (including the engine). Does dart doc support that? The docs are a little vague about this: https://github.com/dart-lang/dartdoc/blob/d9e31ff950c92350b464b859eaac272a97e15070/README.md?plain=1#L447-L451

goderbauer avatar Apr 23 '24 17:04 goderbauer