createAdaptiveMonochromeIcons function

void createAdaptiveMonochromeIcons(
  1. Config config,
  2. String? flavor
)

Implementation

void createAdaptiveMonochromeIcons(
  Config config,
  String? flavor,
) {
  utils.printStatus('Creating adaptive monochrome icons Android');

  // Retrieve the necessary Flutter Launcher Icons configuration from the pubspec.yaml file
  final String? monochromeImagePath = config.adaptiveIconMonochrome;
  if (monochromeImagePath == null) {
    throw const InvalidConfigException(errorMissingImagePath);
  }
  final Image? monochromeImage = utils.decodeImageFile(monochromeImagePath);
  if (monochromeImage == null) {
    return;
  }

  // Create adaptive icon monochrome images
  for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) {
    overwriteExistingIcons(
      androidIcon,
      monochromeImage,
      constants.androidAdaptiveMonochromeFileName,
      flavor,
    );
  }
}