Skip to content

Commit

Permalink
Add legend to D2 diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
freemansoft committed Jul 24, 2023
1 parent c325887 commit b8c5031
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/riverpod_graph/lib/src/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,19 @@ String _buildD2(ProviderGraph providerGraph) {
const _watchLineStyle = '{style.stroke-width: 4}';
const _readLineStyle = '{style.stroke-dash: 4}';

final buffer = StringBuffer();
final buffer = StringBuffer('''
Legend: {
Type: {
Widget.shape: circle
Provider
}
Arrows: {
"." -> "..": read: {style.stroke-dash: 4}
"." -> "..": listen
"." -> "..": watch: {style.stroke-width: 4}
}
}
''');

for (final node in providerGraph.consumerWidgets) {
buffer.writeln('${node.definition.name}.shape: Circle');
Expand Down

0 comments on commit b8c5031

Please sign in to comment.