Skip to content
pubscout

pubspec_generator

5.0.2, released 5 months ago by plugfox.dev

Generates a Dart class containing information from pubspec.yaml.

$ flutter pub add pubspec_generator
Source repository

What it does

Auto-generates a Dart class from your pubspec.yaml file, containing app description, dependencies, and version. This keeps application metadata up-to-date across your project via build_runner or a CLI utility.

AI-written summary of version 5.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to access app version and description programmatically in your code.
  • You want consistent app metadata across multiple platforms automatically.

Skip it when

  • You do not use build_runner or code generation in your project workflow.
  • You only need standard package info without generated files.

Strengths

  • Automates keeping app metadata synchronized with pubspec.yaml.
  • Supports cross-platform compatibility and command-line usage.

Weaknesses

  • Requires setting up build_runner configuration in a build.yaml file.
  • Adds an extra generated file to your codebase.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
7

Add build_runner and pubspec_generator to dev_dependencies, create a build.yaml file for output path configuration, and run build_runner.

dev_dependencies:
  build_runner: ^2.4.0
  pubspec_generator: ^5.0.2

# Run:
# dart run build_runner build --delete-conflicting-outputs

Alternatives

Packages that do the same job and could replace pubspec_generator.

Works with

Packages commonly used together with pubspec_generator: ones it builds on, ones built on it, and its own family.