@@ -48,17 +48,21 @@ Future<void> generateAndroidImages({
4848 await file.delete ();
4949 }
5050 final sourceImage = File (imageSource);
51+ if (await sourceImage.exists ()) {
52+ /// Creating a splash image from the provided asset source
53+ sourceImage.copySync (imagePath);
54+ } else {
55+ throw SplashMasterException (message: 'Image path not found' );
56+ }
5157
52- /// Creating a splash image from the provided asset source
53- sourceImage.copySync (imagePath);
5458 log ("Splash image added to ${mipmap .folder }" );
5559 }
5660}
5761
58- Future <void > generateAndroid12Images ({
59- YamlMap ? android12 ,
62+ Future <void > generateImageForAndroid12AndAbove ({
63+ YamlMap ? android12AndAbove ,
6064}) async {
61- if (android12 == null ) {
65+ if (android12AndAbove == null ) {
6266 log ('Skipping Android 12 configuration as it is not provided.' );
6367 return ;
6468 }
@@ -74,16 +78,20 @@ Future<void> generateAndroid12Images({
7478 }
7579
7680 /// Create image in mipmap directories for the Android 12+
77- if (android12 [YamlKeys .imageKey] != null ) {
81+ if (android12AndAbove [YamlKeys .imageKey] != null ) {
7882 final imagePath = '$mipmapFolder /${AndroidStrings .splashImage12Png }' ;
7983 final file = File (imagePath);
8084 if (await file.exists ()) {
8185 await file.delete ();
8286 }
83- final sourceImage = File (android12[YamlKeys .imageKey]);
87+ final sourceImage = File (android12AndAbove[YamlKeys .imageKey]);
88+ if (await sourceImage.exists ()) {
89+ /// Creating a splash image from the provided asset source
90+ sourceImage.copySync (imagePath);
91+ } else {
92+ throw SplashMasterException (message: 'Image path not found' );
93+ }
8494
85- /// Creating a splash image from the provided asset source
86- sourceImage.copySync (imagePath);
8795 log ("Splash image added to ${mipmap .folder }" );
8896 }
8997 }
@@ -159,14 +167,14 @@ Future<void> createColors({
159167
160168/// Updates the `styles.xml` file for the splash screen setup.
161169Future <void > updateStylesXml ({
162- YamlMap ? android12 ,
170+ YamlMap ? android12AndAbove ,
163171 String ? color,
164172}) async {
165173 const androidValuesFolder = CmdStrings .androidValuesDirectory;
166174
167- if (android12 != null &&
168- (android12 [YamlKeys .colorKey] != null ||
169- android12 [YamlKeys .imageKey] != null )) {
175+ if (android12AndAbove != null &&
176+ (android12AndAbove [YamlKeys .colorKey] != null ||
177+ android12AndAbove [YamlKeys .imageKey] != null )) {
170178 const v31 = CmdStrings .androidValuesV31Directory;
171179 if (! await Directory (v31).exists ()) {
172180 Directory (v31).create ();
@@ -179,8 +187,8 @@ Future<void> updateStylesXml({
179187
180188 createAndroid12Styles (
181189 styleFile: styleFile,
182- color: android12 [YamlKeys .colorKey],
183- imageSource: android12 [YamlKeys .imageKey],
190+ color: android12AndAbove [YamlKeys .colorKey],
191+ imageSource: android12AndAbove [YamlKeys .imageKey],
184192 );
185193 }
186194 final xml = File ('$androidValuesFolder /${AndroidStrings .stylesXml }' );
0 commit comments