snake_case property

String? get snake_case

Implementation

String? get snake_case {
  if (this == null) return null;
  if (this!.isEmpty) return this;
  return this!
      .replaceAllMapped(
          RegExp(r'[A-Z]'), (Match m) => '_${m[0]!.toLowerCase()}')
      .toLowerCase()
      .trim();
}