overwriteExistingIcons function

Future<void> overwriteExistingIcons(
  1. AndroidIconTemplate template,
  2. Image image,
  3. String filename,
  4. String? flavor, {
  5. String prefixPath = '.',
})

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

Future<void> overwriteExistingIcons(
  AndroidIconTemplate template,
  Image image,
  String filename,
  String? flavor, {
  String prefixPath = '.',
}) async {
  final Image newFile = utils.createResizedImage(template.size, image);
  final pngFile = await File(
    path.join(
      prefixPath,
      constants.androidResFolder(flavor),
      template.directoryName,
      filename,
    ),
  ).create(recursive: true);
  await pngFile.writeAsBytes(encodePng(newFile));
}