Skip to content

[vector_graphics] IMPROVEMENT: add an arg to skip non svg files #158869

@stuartmorgan-g

Description

@stuartmorgan-g

Imported from dnfield/vector_graphics#250

Original report by @alefwd on Jul 30, 2024

I have a folder /assets where I have a mix of svgs and json files, and I cannot change this. I would like to be able to apply the vector_graphics_compiler transformation to the folder.
When I tried something like:

    - path: assets/
      transformers:
        - package: vector_graphics_compiler

I received exceptions relative to transforming the json files.

What I propose is either to skip non svg files by default, or to enable it using an arg:

    - path: assets/
      transformers:
        - package: vector_graphics_compiler
           args: ['--svg-only']

Comment by @t-unit on Aug 9, 2024
I also run into this sometimes with files generated by the OS, very annoying. E.g. for .DS_Store:

Target debug_android_application failed: Error: User-defined transformation of asset "/Users/***/assets/vector/.DS_Store" failed.
Transformer process terminated with non-zero exit code: 1
Transformer package: vector_graphics_compiler
Full command: /Users/***/flutter/bin/cache/dart-sdk/bin/dart run vector_graphics_compiler --input=/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0 --output=/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput1
stdout:
XXXXXXXXXXX /var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0 XXXXXXXXXXXXX
FileSystemException: Failed to decode data using encoding 'utf-8', path = '/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0'
#0      _File._tryDecode (dart:io/file_impl.dart:615:7)
#1      _File.readAsStringSync (dart:io/file_impl.dart:624:7)
#2      IsolateProcessor._process.<anonymous closure> (file:///Users/***/.pub-cache/hosted/pub.dev/vector_graphics_compiler-1.1.11+1/bin/util/isolate_processor.dart:110:37)
isolate_processor.dart:110
#3      _RemoteRunner._run (dart:isolate:1090:47)
#4      _RemoteRunner._remoteExecute (dart:isolate:1084:12)
#5      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
#6      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolec: proposalA detailed proposal for a change to Flutterfound in release: 3.32Found to occur in 3.32fyi-toolFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: vector_graphicsThe vector_graphics package setpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions