flutter_pub_analyzer 0.1.1 copy "flutter_pub_analyzer: ^0.1.1" to clipboard
flutter_pub_analyzer: ^0.1.1 copied to clipboard

A powerful CLI tool to analyze and manage Dart & Flutter dependencies.

flutter_pub_analyzer #

A powerful CLI tool to analyze and manage Dart & Flutter dependencies. This tool helps developers understand their project's dependency tree, identify used and unused packages/assets, and assess the health of their dependencies.

Features #

  • Dependency Analysis: Scans pubspec.yaml and pubspec.lock to list direct and transitive dependencies.
  • Dependency Health Reporting: Fetches health scores (pubScore, likes, popularity, maintenance status) from pub.dev for each dependency.
  • Used Package/Asset Detection: Identifies packages and assets actually used in the project source code. (Note: Asset scanning is planned, but not fully implemented in the provided code)
  • Dependency Graph Visualization: Generates Graphviz DOT or Mermaid-compatible strings to visualize the dependency tree.
  • CLI Interface: Easy-to-use command-line interface for analysis and reporting.

Installation #

This is a Dart CLI tool. You can install it globally or run it directly from its source code.

From Pub.dev (Coming Soon) #

Once published to pub.dev, you will be able to install it globally using:

dart pub global activate flutter_pub_analyzer

From Source #

  1. Clone the repository:
    git clone https://github.com/your_username/flutter_pub_analyzer.git
    cd flutter_pub_analyzer
    
  2. Get dependencies:
    dart pub get
    

Usage #

The tool provides two main commands: analyze and graph.

analyze Command #

The analyze command performs a comprehensive analysis of your project's dependencies and used resources.

dart run bin/flutter_pub_analyzer.dart analyze

Output Example:

Running analysis...
Dependencies found: 5
  - path (1.8.3) - Health: Good
  - http (0.13.5) - Health: Excellent
  - args (2.3.0) - Health: Good
  - yaml (3.1.0) - Health: Excellent
  - test (1.19.5) - Health: Excellent
Used packages: 3
Used assets: 0

(Note: The actual output will vary based on project dependencies and the HealthFetcher results. The asset count is currently 0 as per asset_scanner.dart initial implementation)

graph Command #

The graph command generates a string representation of your dependency graph, which can be used with visualization tools like Graphviz or Mermaid.

Generate Graphviz DOT string

To generate a Graphviz DOT string:

dart run bin/flutter_pub_analyzer.dart graph --dot

Output Example:

digraph G {
  rankdir=LR;
  node [shape=box];
  "flutter_pub_analyzer" -> "path";
  "flutter_pub_analyzer" -> "http";
  "path" [label="path\n1.8.3"];
  "http" [label="http\n0.13.5"];
  // ... more nodes and edges
}

You can then use a Graphviz viewer (e.g., dot -Tpng input.dot -o output.png) to visualize this graph.

Generate Mermaid-compatible string

To generate a Mermaid-compatible string:

dart run bin/flutter_pub_analyzer.dart graph --mermaid

Output Example:

graph LR
  flutter_pub_analyzer-->path
  flutter_pub_analyzer-->http
  path[path\n1.8.3]
  http[http\n0.13.5]
  // ... more nodes and edges

You can paste this string into a Mermaid live editor or integrate it with tools that support Mermaid syntax.

Contributing #

We welcome contributions! Please see our CONTRIBUTING.md for more details. (Note: CONTRIBUTING.md does not exist yet, this is a placeholder)

License #

This project is licensed under the MIT License.

0
likes
140
points
28
downloads

Documentation

API reference

Publisher

verified publisherrajkavadia.dev

Weekly Downloads

A powerful CLI tool to analyze and manage Dart & Flutter dependencies.

Homepage

License

MIT (license)

Dependencies

args, http, path, yaml

More

Packages that depend on flutter_pub_analyzer