overwriteExistingIcons function

void overwriteExistingIcons(
  1. AndroidIconTemplate template,
  2. Image image,
  3. String filename,
  4. String? flavor,
)

Overrides the existing launcher icons in the project Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic interpolation) https://github.com/fluttercommunity/flutter_launcher_icons/issues/101#issuecomment-495528733

Implementation

void overwriteExistingIcons(
    AndroidIconTemplate template, Image image, String filename, String? flavor) {
  final Image newFile = createResizedImage(template.size, image);
  File(constants.androidResFolder(flavor) +
          template.directoryName +
          '/' +
          filename)
      .create(recursive: true)
      .then((File file) {
    file.writeAsBytesSync(encodePng(newFile));
  });
}