convert method Null safety

  1. @override
String convert(
  1. String phrase
)
override

Converts the input phrase to 'spinal case', i.e. a hyphen-delimited, lowercase form. Also known as 'kebab case' or 'lisp case'.

Implementation

@override
String convert(String phrase) {
  return phrase
      .replaceAllMapped(_underscoreRE0, (match) => "${match[1]}_${match[2]}")
      .replaceAllMapped(_underscoreRE1, (match) => "${match[1]}_${match[2]}")
      .replaceAll(_underscoreRE2, "_")
      .toLowerCase();
}