FLUTTER ECOSYSTEM

pubspec_generator

Code generator pubspec.yaml.g.dart from pubspec.yaml. Just import `pubspec_generator` and then run `dart run build_runner build`

pubspec_generator cover
Latest version
5.0.2
30-day downloads
1.9K
Likes
45
Pub points
140

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

A Flutter/Dart package that generates a `pubspec.yaml.g.dart` file from your project's `pubspec.yaml`. It automates the extraction of asset, dependency, and other metadata into a Dart file, enabling type-safe access to pubspec data. Simply add the package and run `dart run build_runner build` to generate the output. Ideal for projects needing dynamic access to pubspec information without parsing YAML manually.

Use cases
  • Accessing asset paths programmatically
  • Generating code from pubspec dependencies
  • Enabling type-safe pubspec metadata
  • Automating asset management in builds
  • Integrating pubspec data into app logic
Key features
  • Generates Dart code from pubspec.yaml
  • Supports all Flutter platforms
  • Uses build_runner for automation
  • Provides type-safe pubspec access
  • Minimal setup required
Suitable for
  • Projects with complex asset structures
  • Build-time code generation needs
  • Apps requiring dynamic pubspec access
  • Teams wanting automated pubspec handling
  • Developers using build_runner workflows
Considerations
  • Requires build_runner to be set up
  • Generated files should not be edited manually
  • May increase build time slightly
  • Not needed for simple projects
  • Depends on correct pubspec.yaml formatting
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add pubspec_generator

Categories

Dependencies

Dependency list 7 items

Source repository

Related projects