change_case
2.2.0, released 2 years ago by mrgnhnt.com
Extension on String to convert between many common case styles
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.
83Compare - tint
Terminal string styling as an extension on String.
50Compare - numerus
Translate integers to Roman numerals and Roman numeral strings to integers in Dart.
63Compare - multiline
Provides convenient access to multiline String records with method extensions.
45Compare
Works with
Packages commonly used together with change_case: ones it builds on, ones built on it, and its own family.
- native_toolchain_cmakeBuilt on change_caseA library to invoke and build CMake projects for Dart Native Assets.
- commitlint_cliBuilt on change_caseCLI tool that lints commit messages against the Conventional Commits spec.
- equatable_genBuilt on change_caseGenerates Equatable props getters via build_runner
- dart_evalBuilt on change_caseA flexible Dart bytecode compiler and interpreter for dynamic execution and code push.
- sdl3Built on change_caseDart library for accessing SDL3 and related APIs via FFI.
- titlebar_buttonsBuilt on change_caseProvides native-looking titlebar buttons for Windows, Linux, and macOS.
- macro_kitBuilt on change_caseA development-time macro system for instant code generation without build_runner.