PubspecService class

Provides utilities for updating the project's pubspec.yaml file.

Supports adding dependencies, configuring Flutter localization generation, saving changes, and running dependency resolution after modifications.

Constructors

PubspecService({bool runPubGet = true})
Creates a service for managing the project's pubspec configuration.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runPubGet → bool
Whether dependency resolution should be executed after saving changes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

ensureDependencies(Map<String, String> packages) → Future<void>
Ensures that all provided packages exist in the project dependencies.
ensureDependency(String package, {String version = 'any', bool ensureLoaded = false}) → Future<void>
Ensures that package exists in the project's dependencies.
ensureDevDependencies(Map<String, String> packages) → Future<void>
Ensures that all provided packages exist in the development dependencies.
ensureDevDependency(String package, {String version = 'any', bool ensureLoaded = false}) → Future<void>
Ensures that package exists in the project's development dependencies.
ensureFlutterGenerate() → Future<void>
Ensures that Flutter code generation is enabled in pubspec.yaml.
ensureFlutterSdkDependency(String package) → Future<void>
Ensures that package exists as a Flutter SDK dependency.
ensureLocalization({bool syncDependencies = true}) → Future<void>
Ensures that the project is configured for Flutter localization.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save() → Future<void>
Saves pending changes to pubspec.yaml.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited