lakos 2.0.5 copy "lakos: ^2.0.5" to clipboard
lakos: ^2.0.5 copied to clipboard

Visualize internal Dart library dependencies in Graphviz dot. Detect dependency cycles.

example/example.dart

import 'dart:io';
import 'package:lakos/lakos.dart';

void main() {
  var model =
      buildModel(Directory('.'), ignoreGlob: 'test/**', showMetrics: true);
  print(model.getOutput(OutputFormat.dot));
  print(model.getOutput(OutputFormat.json));

  if (!model.metrics!.isAcyclic) {
    print('Dependency cycle detected.');
  }

  var nodesSortedBySloc = model.nodes.values.toList();
  nodesSortedBySloc.sort((a, b) => a.sloc!.compareTo(b.sloc!));
  for (var node in nodesSortedBySloc) {
    print('${node.sloc}: ${node.id}');
  }

  // Further analysis with the directed_graph library
  var digraph = model.toDirectedGraph();
  print(digraph.topologicalOrdering);
}
128
likes
160
points
5.28k
downloads

Publisher

verified publisherolegalexander.com

Weekly Downloads

Visualize internal Dart library dependencies in Graphviz dot. Detect dependency cycles.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

args, darq, directed_graph, glob, path

More

Packages that depend on lakos