loadConfigFromPath static method

FlutterLauncherIconsConfig? loadConfigFromPath(
  1. String filePath,
  2. String prefixPath
)

Loads flutter launcher icons configs from given filePath

Implementation

static FlutterLauncherIconsConfig? loadConfigFromPath(
  String filePath,
  String prefixPath,
) {
  final configFile = File(path.join(prefixPath, filePath));
  if (!configFile.existsSync()) {
    return null;
  }
  final configContent = configFile.readAsStringSync();
  try {
    return yaml.checkedYamlDecode<FlutterLauncherIconsConfig?>(
      configContent,
      (json) {
        // TODO(RatakondalaArun): add support for new scheme https://github.com/fluttercommunity/flutter_launcher_icons/issues/373
        return json == null || json['flutter_icons'] == null
            ? null
            : FlutterLauncherIconsConfig.fromJson(json['flutter_icons']);
      },
      allowNull: true,
    );
  } on yaml.ParsedYamlException catch (e) {
    throw InvalidConfigException(e.formattedMessage);
  } catch (e) {
    rethrow;
  }
}