Skip to content

Update the flutter pubspec-analyzing code to allow more complex asset declarations #54038

Closed
@andrewkolos

Description

@andrewkolos

flutter/flutter#132985 will allow a new type of asset declaration within the pubspec.yaml file of Flutter projects. In particular, it will allow entries in the assets list to either be strings (as they are today), or maps with a path and a flavors list. Consider this example:

# pubspec.yaml file for a Flutter project
# ...
flutter:
# ...
  assets:
    - assets/common/ # Nothing new here.
    - path: assets/premium/ # Newly allowed asset declaration syntax.
      flavors: # This is a list of arbitrary, nonempty strings.
        - premium

Since the analyzer includes code to validate the assets section within Flutter pubspecs, the analyzer raises warnings when validating pubspecs such as example one just mentioned:

andrewkolos-macbookpro:flavor_specific_assets andrewkolos$ flutter analyze
Analyzing flavor_specific_assets...                                     

warning • Assets are required to be file paths (strings) • pubspec.yaml:22:7 • asset_not_string

Before this feature is landed, the analyzer code should be updated to account for the new syntax.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ondevexp-warningIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions