Skip to content
pubscout

change_case

2.2.0, released 2 years ago by mrgnhnt.com

Extension on String to convert between many common case styles

WASM-ready
$ flutter pub add change_case
Source repository

What it does

Provides a set of extension methods that transform a string into camelCase, PascalCase, snake_case, param-case, CONSTANT_CASE, and other common naming conventions. It also includes utilities for checking case and swapping capitalization.

AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to format identifiers or display strings in different naming conventions
  • You want a lightweight, dependency‑free helper for case conversion in Dart code

Skip it when

  • You need a full text‑processing library with regex customization beyond case conversion
  • You are already using a code‑generation tool that handles naming conventions

Strengths

  • No external dependencies beyond meta
  • Supports a wide range of case styles out of the box
  • Simple extension methods keep code readable
  • MIT license allows unrestricted use

Weaknesses

  • Limited to string case conversion only
  • No advanced regex customization without modifying config
  • No support for locale‑specific casing rules

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Add dependency to pubspec and import 'package:change_case/change_case.dart'; no build_runner or permissions required

import 'package:change_case/change_case.dart';

void main() {
  print('test string'.toCamelCase()); // testString
  print('test string'.toSnakeCase()); // test_string
}

Alternatives

Packages that do the same job and could replace change_case.

  • validators2

    String validation and sanitization for Dart.

  • tint

    Terminal string styling as an extension on String.

  • numerus

    Translate integers to Roman numerals and Roman numeral strings to integers in Dart.

  • multiline

    Provides convenient access to multiline String records with method extensions.

Works with

Packages commonly used together with change_case: ones it builds on, ones built on it, and its own family.