Skip to content

Analyzer complains about missing asset if you specify a folder in pubspec.yaml for Flutter #33550

Closed

Description

@dnfield

Flutter introduced the ability to specify asset directories (and just include all files) instead of needing to specify all files as of flutter/flutter#16413

This has now landed in beta.

So I can do this:

  assets:
    - assets/
    - assets/w3samples/
    ...

instead of

  assets:
    - assets/flutter.svg
    - assets/dart_logo.svg
    - assets/w3samples/aa.svg
    ...

However, the analyzer now gives me warnings in this case that the asset is not found:

warning • The asset assets/ does not exist • pubspec.yaml:36:7
warning • The asset assets/w3samples/ does not exist • pubspec.yaml:37:7

Activity

  1. dnfield commented on Jun 21, 2018

    @dnfield
    ContributorAuthor

    Is there some way to tell the analyzer to ignore this in analysis_options.yaml or pubspec.yaml? I tried # ignore_for_file: asset_does_not_exist to no avail. Also tried setting that to ignore in analysis_options.yaml but that complains it doesn't exist.

  2. dnfield commented on Jun 21, 2018

    @dnfield
    ContributorAuthor

    Hah - I was looking at the code and became confused cause it seemed like it should work .. and that's because the PR was merged in yesterday d895b49

  3. dnfield commented on Jun 21, 2018

    @dnfield
    ContributorAuthor

    This ignores it for now - in analysis_options.yaml

    analyzer:
      errors:
        # allow for asset_does_not_exist
        unrecognized_error_code: ignore
        # ignore this in pubspec.yaml
        asset_does_not_exist: ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions