jonbhanson / flutter_native_splash

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.
https://pub.dev/packages/flutter_native_splash
MIT License
1.28k stars 200 forks source link

[Bug] Process exits with success code in case of invalid YAML configuration #656

Closed smit-ghl closed 3 months ago

smit-ghl commented 3 months ago

Describe the bug When provided invalid configuration in the YAML file, process exits with success code and only prints the configuration param related error. Process should exit with some error code so that script execution fails in this case.

Configuration

flutter_native_splash:
  image: "assets/splash.png"
  color: "#FFFFFF"
  android: true
  ios: true
  color_dark: "#1B1B1D"
  image_dark: "assets/splash-dark.png"
  android12:
    image: "assets/splash.png"
    icon_background_color: "#ffffff"
    image_dark: "assets/splash-dark.png"
    icon_background_color_dark: "#1B1B1D"

Device (please complete the following information):

To Reproduce Steps to reproduce the behavior, using the example app:

  1. In pubspec.yaml under flutter_native_splash section, use some invalid key which is not supported by flutter_native_splash. Refer invalid configuration we mentioned above.
  2. In our case, we were using android12 by mistake instead of android_12.
  3. Run dart run flutter_native_splash:create
  4. This will print error "⚠️ The parameter "android12" was found in your flutter_native_splash config, but "android12" is not a valid flutter_native_splash parameter."
  5. The process exits with 0 as code in this case which means process completed without any issue.

Screenshots

Screenshot 2024-01-25 at 1 55 25 PM

Additional context We are suggesting a change to return 1 as code while making process exit when YAML to configuration mapping detects any invalid key. This will mark the script as failed with error.