UseDesignSystemItemConfig.fromConfig constructor

UseDesignSystemItemConfig.fromConfig(
  1. Map<String, Object?> json
)

Implementation

factory UseDesignSystemItemConfig.fromConfig(Map<String, Object?> json) {
  final replacements = json.entries.map(
    (entry) => MapEntry(
      entry.key,
      [
        for (final forbidden in entry.value! as List)
          (
            name: (forbidden as Map)['instead_of'] as String,
            packageName: forbidden['from_package'] as String,
          ),
      ],
    ),
  );

  return UseDesignSystemItemConfig(Map.fromEntries(replacements));
}