PubspecValidator class

Validates assets against pubspec.yaml configuration.

This class provides static methods to validate that generated assets are properly declared in the flutter.assets section of pubspec.yaml and to identify any discrepancies.

Example

final result = PubspecValidator.validateAssets(
  assetPaths: ['assets/logo.png', 'assets/icon.svg'],
  roots: ['assets'],
);

if (!result.isValid) {
  PubspecValidator.printValidationReport(result);
}

Constructors

PubspecValidator()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

printValidationReport(ValidationResult result) → void
Prints a formatted validation report to the console.
validateAssets({required List<String> assetPaths, required List<String> roots, String? pubspecPath}) ValidationResult
Validates asset paths against pubspec.yaml.