flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[BUG]: Build Issue with FlutterGen When Excluding Paths with Special Characters in Filenames

Open sAtluna opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

5.4.0

Command type

build_runner (Default)

What happened?

Hello,

I've been using your package and encountered a specific problem when excluding directories in pubspec.yaml for FlutterGen. This issue involves handling filenames with special characters, such as a plus sign (+), which aren't processed correctly despite being in an excluded directory.

Configuration:

flutter_gen:
  output: lib/assets/
  assets:
    outputs:
      class_name: MyAssets
    exclude:
      - assets-extern/

Problem: Despite excluding the assets-extern/ directory, FlutterGen processes files from this directory, leading to a build error:

Operator declarations must be preceded by the keyword 'operator'.
AssetGenImage get myasset+ffffff => const AssetGenImage('assets-extern/myasset+_fffff.jpg');

It seems, that FlutterGen is parsing first everything and then applying a filter with the declared excluded paths. I understand this is a very special case due to the unique filenames connected to our database models. However, I confirmed the build runner recognizes this configuration. Is there a possible solution to handle filenames with special characters?

Thank you!

Relevant a pubspec.yaml.

flutter_gen:
  output: lib/assets/ 
  
  assets:
    outputs:
      class_name: MyAssets

    exclude:
      - assets-extern/

Relevant log output

Operator declarations must be preceded by the keyword 'operator'.

        AssetGenImage get myasset+ffffff => const AssetGenImage('assets-extern/myasset+_fffff.jpg');

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

sAtluna avatar Apr 24 '24 08:04 sAtluna