execute method

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

Implementation

@override
Future<void> execute() async {
  if (config.iconPath == null) {
    print("⚠️ Skipping Asset Generation: icon_path is missing.");
    return;
  }

  // Use the scaling factor from the configuration
  final processedImage = processImage(
    config.iconPath!,
    scaling: config.splashScreenScale,
  );

  // Save the processed image for the native generators to use
  final processedPath = 'rebrand_processed_asset.png';
  File(processedPath).writeAsBytesSync(img.encodePng(processedImage));

  if (config.enableSplash && config.splash != null) {
    // Generate the splash using the perfectly padded image
    await _writeAndRunSplash(processedPath);
  }

  if (config.enableLauncherIcon) {
    // Generate launcher icons using the original image (no scaling)
    await _writeAndRunIcons(config.iconPath!);
  }

  // Cleanup the temporary processed image
  if (File(processedPath).existsSync()) {
    File(processedPath).deleteSync();
  }
}