I added Flutter Native Splash screen to my dependencies. The color appears with no problem but the image is not appearing and I don't know why.
Pubspec.yaml:
#flutter native splash
flutter_native_splash: ^2.2.19
flutter_native_splash:
image: assets\RoderLogoo.png
color: "#2A52BE"
android: true
ios: true
web: true
flutter:
assets:
- assets/
The image does exist, I've tried using every possible size of the image possible, the size I am using right now is 192x162
The image is transparent but I don't think that has to do with anything. the path is correct (the file where I store all my photos is assets.
Any ideas?
As in your question, can find problem.
As first for flutter_native_splash you used wrong slag. Actually must use forward slag like in the comment that @Shivam Jamaiwar said.
flutter_native_splash:
image: assets/RoderLogoo.png
color: "#2A52BE"
As second you should use specific image file name rather than directory name in yaml file. Like that. Because sometime image without specific name can't load from assets file.
flutter:
assets:
- assets/RoderLogoo.png
Edit: Procedure to add and fix
flutter_native_splash.yaml in the root directory and copy&paste code from documentation.flutter_native_splash.yaml file you need to setting up to appear your image on native splash screen. But as documentation “Only one parameter can be used, color and background_image cannot both be set.” So add setting for image like that
background_image: "assets/splash_image.jpg".flutter pub run flutter_native_splash:create and flutter pub run flutter_native_splash:create --flutter_native_splash.yaml.when writing image path use forward slash / not backward slash \
flutter_native_splash:
image: "assets/RoderLogoo.png"
color: "#2A52BE"
android: true
ios: true
then you need to run three commands after saving your yaml file
run following commands:
flutter cleanflutter pub getflutter pub run flutter_native_splash:createIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With