createIcons method

  1. @override
void createIcons(
  1. Map<String, dynamic> config,
  2. String? flavor
)
override

Create all icons for the current platform based on the contents of config and the flavor.

Implementation

@override
void createIcons(Map<String, dynamic> config, String? flavor) {
  final String filePath = config['image_path_web'] ?? config['image_path'];
  final Image? image = decodeImage(File(filePath).readAsBytesSync());
  if (image== null)
    return;

  final dynamic webConfig = config['web'];

  // If a String is given, the user wants to be able to revert
  //to the previous icon set. Back up the previous set.
  if (webConfig is String) {
    // As there is only one favicon, fail. Request that the user
    //manually backup requested icons.
    print(constants.errorWebCustomLocationNotSupported);
  } else {
    printStatus('Overwriting web favicon');

    for (IconTemplate template in webIcons) {
      _overwriteDefaultIcon(template, image);
    }
  }
}