ConfigData.fromYaml constructor

ConfigData.fromYaml(
  1. YamlMap yaml
)

Implementation

factory ConfigData.fromYaml(YamlMap yaml) {
  final pubspec = Pubspec.fromJson(yaml);
  final rawScripts = yaml['scripts'];
  if (rawScripts is! YamlMap?) {
    throw StateError('Invalid scripts section');
  }

  final dpkConfig = DpkConfig.fromYaml(yaml);
  late final Scripts? scripts;
  if (rawScripts != null) {
    scripts = Scripts.fromYaml(rawScripts);
  } else {
    scripts = null;
  }

  return ConfigData(pubspec: pubspec, dpkConfig: dpkConfig, scripts: scripts);
}