Skip to content
pubscout

pubspec_manager

4.1.1, released 3 weeks ago by onepub.dev

Type-safe API to read, modify, and write pubspec.yaml while preserving comments.

$ flutter pub add pubspec_manager
Source repository

What it does

pubspec_manager lets you load a pubspec.yaml into a strongly typed object, change any field or comment, and write it back. It keeps all comments and non‑spec content intact.

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

Use it when

  • You need to programmatically update a pubspec and keep comments
  • You want a type‑safe interface for pubspec manipulation
  • You need to read/write pubspecs in a build script or CI

Skip it when

  • You only need simple YAML parsing
  • You are working on a very large monorepo where performance is critical

Strengths

  • Preserves comments and formatting
  • Full support for all documented pubspec keys
  • Type‑safe API reduces runtime errors
  • Allows access to non‑spec content via Document view

Weaknesses

  • No code generation support
  • Not a general YAML library
  • Limited to pubspec.yaml use cases

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
final pubspec = PubSpec.load();
pubspec.version.set('1.2.3');
pubspec.save();

Alternatives

Packages that do the same job and could replace pubspec_manager.

Works with

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