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('Checking $platformName config...');
final macOSConfig = context.macOSConfig;
if (macOSConfig == null || !macOSConfig.generate) {
context.logger
..verbose(
'$platformName config is missing or "flutter_icons.macos.generate" is false. Skipped...',
)
..verbose(macOSConfig);
return false;
}
if (macOSConfig.imagePath == null && context.config.imagePath == null) {
context.logger
..verbose({
'flutter_launcher_icons.macos.image_path': macOSConfig.imagePath,
'flutter_launcher_icons.image_path': context.config.imagePath,
})
..error(
'Missing image_path. Either provide "flutter_launcher_icons.macos.image_path" or "flutter_launcher_icons.image_path"',
);
return false;
}
// this files and folders should exist to create macos icons
final enitiesToCheck = [
path.join(context.prefixPath, constants.macOSDirPath),
path.join(context.prefixPath, constants.macOSIconsDirPath),
path.join(context.prefixPath, constants.macOSContentsFilePath),
];
final failedEntityPath = utils.areFSEntiesExist(enitiesToCheck);
if (failedEntityPath != null) {
context.logger.error(
'$failedEntityPath this file or folder is required to generate $platformName icons',
);
return false;
}
return true;
}