pascalToKebab function

String pascalToKebab(
  1. String name
)

ProAnalytics -> pro-analytics — maps a generated slice/entity name onto its feature-flag name so the generation pipeline can match a requested name against the disabled feature-set.

Implementation

String pascalToKebab(String name) => name
    .replaceAllMapped(
      RegExp(r'([A-Z])'),
      (m) => '-${m.group(1)!.toLowerCase()}',
    )
    .replaceFirst(RegExp('^-'), '');