validateRequirements method
Should return true
if this platform
has all the requirements to create icons.
This runs before to createIcons
Implementation
@override
bool validateRequirements() {
context.logger.verbose('Validating windows config...');
final windowsConfig = context.windowsConfig;
if (windowsConfig == null || !windowsConfig.generate) {
context.logger.error(
'Windows config is not provided or windows.generate is false. Skipped...',
);
return false;
}
if (windowsConfig.imagePath == null && context.config.imagePath == null) {
context.logger.error(
'Invalid config. Either provide windows.image_path or image_path',
);
return false;
}
// if icon_size is given it should be between 48<=icon_size<=256
// because .ico only supports this size
if (windowsConfig.iconSize != null &&
(windowsConfig.iconSize! < 48 || windowsConfig.iconSize! > 256)) {
context.logger.error(
'Invalid windows.icon_size=${windowsConfig.iconSize}. Icon size should be between 48<=icon_size<=256',
);
return false;
}
final entitesToCheck = [
path.join(context.prefixPath, constants.windowsDirPath),
path.join(
context.prefixPath,
windowsConfig.imagePath ?? context.config.imagePath,
),
];
final failedEntityPath = utils.areFSEntiesExist(entitesToCheck);
if (failedEntityPath != null) {
context.logger.error(
'$failedEntityPath this file or folder is required to generate web icons',
);
return false;
}
return true;
}