Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Created June 25, 2021 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subfuzion/65a9d5b12000f818c79185142a83785e to your computer and use it in GitHub Desktop.
Save subfuzion/65a9d5b12000f818c79185142a83785e to your computer and use it in GitHub Desktop.
Render UML diagram for your Dart package using dcdg and plantuml
  1. Install plantuml

For example, on macOS you can use a Homebrew formula:

brew install plantuml

If plantuml fails to install, check the output for any missing formulae. For example, you may need to run the following before installing plantuml will succeed:

brew tap gromgit/fuse

Then run:

brew reinstall plantuml
  1. Install Dart Class Diagram Generator (dcdg)
dart pub global activate dcdg
  1. Generate a diagram grammar file

From the root of your repo, run dcdg and supply an output file name (ex: package.uml or package.plantuml).

Example:

cd lib
dcdg -o package.uml

For greater control over the generated diagram, including source locations, grammar, and filters, see usage options.

  1. Render a diagram image using the generated grammar file
plantuml package.uml

This will generate a file called package.png. Use the -o option to specify a different name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment