execute method

  1. @override
Future<void> execute()
override

Implementation

@override
Future<void> execute() async {
  final tempFiles = <String>[];

  try {
    if (config.enableSplash) {
      final splashImagePath = _prepareSplashImage(
        config.splashImagePath,
        'rebrand_processed_splash.png',
        tempFiles,
      );
      final splashDarkImagePath = _prepareSplashImage(
        config.splashDarkImagePath,
        'rebrand_processed_splash_dark.png',
        tempFiles,
      );
      final android12ImagePath = _prepareSplashImage(
        config.android12ImagePath,
        'rebrand_processed_android12_splash.png',
        tempFiles,
      );
      final android12DarkImagePath = _prepareSplashImage(
        config.android12DarkImagePath,
        'rebrand_processed_android12_splash_dark.png',
        tempFiles,
      );

      if (splashImagePath != null && android12ImagePath != null) {
        await _writeAndRunSplash(
          imagePath: splashImagePath,
          darkImagePath: splashDarkImagePath,
          android12ImagePath: android12ImagePath,
          android12DarkImagePath: android12DarkImagePath,
        );
      }
    }

    if (config.enableLauncherIcon && config.iconPath != null) {
      await _writeAndRunIcons(config.iconPath!);
    }
  } finally {
    for (final path in tempFiles) {
      final file = File(path);
      if (file.existsSync()) {
        file.deleteSync();
      }
    }
  }
}