3

How can you use local assets in a dart documentation comment? This works fine when using a webbased url,, like so:

/// ![A row of icons representing a pink heart, a green musical note, and a blue umbrella](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png)

What I would like to do is reference some image assets I have in my assets folder and display that. Something like this:

///![](/assets/some/local/path.png)
///![](/assets/some/other/path.svg)

But I cannot get any relative path to work, is this possible at all?

Isak dl
  • 448
  • 3
  • 13

1 Answers1

1

It's not entirely satisfying, but I just made a shell script to copy images that are part of the documentation into the right place in the generated HTML tree, viz:

#!/bin/sh -x
cd `dirname $0`
dartdoc
cd lib
for f in `find . -name '*.comments' -print` ; do
    dir=`basename $f .comments`
    cp -r $f ../doc/api/$dir
done
cd ..

ObRant: It disappoints me that documentation generation tools often don't generally this (at least AFAIK). Visual communication can greatly improve documentation!

For example, consider this bit of Java. The UML is a big help in understanding the structure. http://spritely.jovial.com/javadocs/index.html?edu/calpoly/spritely/package-summary.html

Bill Foote
  • 361
  • 3
  • 3