toDotCase method

String toDotCase()

Convert string to dot case.

Implementation

String toDotCase() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  return this!.splitMapJoin(RegExp(r'[_\s]+'),
      onMatch: (match) => match.group(0)!.toLowerCase(),
      onNonMatch: (nonMatch) =>
          nonMatch[0].toLowerCase() +
          nonMatch.substring(1).replaceAllMapped(RegExp(r'[A-Z]'),
              (match) => '.${match.group(0)!.toLowerCase()}'));
}