validateRequirements method

  1. @override
bool validateRequirements()
override

Should return true if this platform has all the requirements to create icons. This runs before to createIcons

Implementation

@override
bool validateRequirements() {
  // check if web config exists
  context.logger.verbose('Checking webconfig...');
  final webConfig = context.webConfig;
  if (webConfig == null || !webConfig.generate) {
    context.logger.verbose(
      'Web config is not provided or generate is false. Skipped...',
    );
    return false;
  }
  if (webConfig.imagePath == null && context.config.imagePath == null) {
    context.logger
        .verbose('Invalid config. Either provide web.imagePath or imagePath');
    return false;
  }

  // verify web platform related files and directories exists
  final entitesToCheck = [
    path.join(context.prefixPath, constants.webDirPath),
    path.join(context.prefixPath, constants.webManifestFilePath),
    path.join(context.prefixPath, constants.webIndexFilePath),
  ];

  // web platform related files must exist to continue
  final failedEntityPath = utils.areFSEntiesExist(entitesToCheck);
  if (failedEntityPath != null) {
    context.logger.error(
      '$failedEntityPath this file or folder is required to generate web icons',
    );
  }

  return true;
}