enumToReadableString function

String enumToReadableString(
  1. Enum e
)

Converts enum to a readable string with spaces and in lower case.

Implementation

String enumToReadableString(Enum e) {
  return e.name
      .splitMapJoin(RegExp(r"(?=[A-Z])"),
          onMatch: (m) => ' ${m.group(0)}', onNonMatch: (n) => n)
      .toLowerCase();
}