flutter_launcher_icons
flutter_launcher_icons copied to clipboard
[BUG]
Version: v^0.8.0
:speech_balloon: Description
Can't run flutter pub run flutter_launcher_icons:main . I have 3 different flavors yaml files.
For example this flutter_launcher_icons-dev.yaml :
flutter_icons: android: true ios: true image_path: "assets/launcher_icon/<image-name>.png"
The error when I run that command: ✗ ERROR: NoConfigFoundException
Check that your config file flutter_launcher_icons.yaml has a flutter_icons section
When I run flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-dev.yaml :
`FileSystemException: Cannot open file, path = 'flutter_launcher_icons-dev.yaml' (OS Error: The system cannot find the file specified. , errno = 2)
✓ Successfully generated launcher icons Unhandled exception: NoSuchMethodError: The method 'containsKey' was called on null. Receiver: null Tried calling: containsKey("image_path")` ...
:scroll: Pubspec.yaml
`name:
publish_to: "none"
version: 1.0.0+1
environment: sdk: ">=2.7.0 <3.0.0"
dependencies: flutter: sdk: flutter
flutter_launcher_icons: ^0.8.0
cupertino_icons: ^0.1.3
dev_dependencies: flutter_test: sdk: flutter
flutter: uses-material-design: true`
Try importing your images first on your pubspec.yaml:
flutter:
assets:
- assets/launcher_icon/<image-name>.png
(PS: don't forget to create an assets directory before inserting the code.)
Then, insert this below flutter so you don't have to create another YAML file.
flutter_icons:
android: true
ios: true
image_path: "assets/<image-name>.png"
The problem with
flutter_icons: android: true ios: true image_path: "assets/<image-name>.png"
is that I have 3 different flavors. I want to run flutter run --flavor {flavor} and different app icon appear.
Following the example here: https://github.com/fluttercommunity/flutter_launcher_icons/tree/master/example/flavors
but this error keeps showing:
✗ ERROR: NoConfigFoundException Check that your config file flutter_launcher_icons.yamlhas aflutter_icons section pub finished with exit code 1
Under lib/main.dart on the flavorConfigFilePattern String I only get a match on my flutter_launcher_icons-<>.yaml files if I change it to: '\.\\\\flutter_launcher_icons-(.*).yaml' instead of '\./flutter_launcher_icons-(.*).yaml'. (I'm on Windows).
However, in the fork, I can run...
Can someone verify this?
I just copied the flutter_launcher_icons-<>.yaml from the fork and paste on my project and they worked for a single file: -f option
However, there are 3 envs that I have. So when the code runs getFlavors() and none of my files match, flavors List will be empty and hasFlavors will be false.

vs

Note: We dart in need to escape both \ so it would be \\\\
The error ✗ ERROR: NoConfigFoundException Check that your config file flutter_launcher_icons.yamlhas aflutter_icons section pub finished with exit code 1 is being made by this function:
loadConfigFileFromArgResults(argResults, verbose: true) > loadConfigFile(String path, String fileOptionResult)
when running: flutter run pub flutter_launcher_icons:main when having multiple flavors.
With the previous fix, running: flutter run pub flutter_launcher_icons:main -f <file_of_choice.yaml> this runs all envs.
I confirm. I have the same issues. Flavor support needs to be documented more. I have my 3 flavor-specific YAML files, now which commands should I run to create icons for each flavor? Ideally a single command should create icons for all flavors at once.
I might have fixed this in #155... Would someone be willing to confirm this?
flutter run pub flutter_launcher_icons:main should run for all flavors. Can't confirm. Still not working for me.
Did you fix it?
Ideally a single command should create icons for all flavors at once.
@sarbogast this actually already happens with the original flavors feature implementation, if you specify a config file then it'll automatically look for any other config files you have and run them too
You can try this out in the example project: https://github.com/fluttercommunity/flutter_launcher_icons/tree/master/example/flavors
Instead of running
flutter run pub flutter_launcher_icons:main
You should run
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-production.yaml
flutter run pub flutter_launcher_icons:main should run for all flavors. Can't confirm. Still not working for me.
I'm not sure I understand @Psycarlo, sorry!
Do you have flavors enabled in your project and you want to edit your pubspec.yaml file with Flutter Launcher Icons and have it change the icon for all flavors?
Also @Psycarlo I'm afraid I don't understand the issue here, would you be able to fork Flutter Launcher Icons and setup the example project so it replicates the issue you're having?
Once you do that I can clone it and run the example to debug what's going wrong
flutter pub run flutter_launcher_icons:main instead of flutter run pub flutter_launcher_icons:main