ReposConfig.fromYaml constructor

ReposConfig.fromYaml(
  1. Map<Object?, Object?> yaml
)

Implementation

factory ReposConfig.fromYaml(Map<Object?, Object?> yaml) {
  final defaultMode = CheckoutMode.tryParse(yaml['defaultMode'] as String?);
  return ReposConfig(
    checkoutRoot: yaml['checkoutRoot'] as String?,
    defaultMode: defaultMode ?? CheckoutMode.published,
    defaultRef: yaml['defaultRef'] as String?,
    defaultBase: yaml['defaultBase'] as String?,
    sources: {
      for (final entry
          in ((yaml['sources'] ?? {}) as Map<Object?, Object?>).entries)
        entry.key.toString(): PackageCheckoutConfig.fromJson(
          entry.key.toString(),
          entry.value,
        ),
    },
  );
}