StringExtensions extension
Extension methods on String providing common text utilities absent from the Dart SDK.
final text = ' hello world ';
print(text.isBlank); // false
print(text.toTitleCase()); // "Hello World"
print(text.toSnakeCase()); // "hello_world"
- on
Properties
- isBlank → bool
-
Available on String, provided by the StringExtensions extension
Whether this string is empty or consists solely of whitespace characters.no setter - isNotBlank → bool
-
Available on String, provided by the StringExtensions extension
Whether this string contains at least one non-whitespace character.no setter
Methods
-
capitalize(
) → String -
Available on String, provided by the StringExtensions extension
Returns a copy of this string with the first character uppercased. -
decapitalize(
) → String -
Available on String, provided by the StringExtensions extension
Returns a copy of this string with the first character lowercased. -
orNull(
) → String? -
Available on String, provided by the StringExtensions extension
Returnsnullif this string isBlank, otherwise returns the string itself. Useful for converting blank strings tonullin forms. -
removeDiacritics(
) → String -
Available on String, provided by the StringExtensions extension
Returns a copy of this string with common diacritical marks removed. -
toCamelCase(
) → String -
Available on String, provided by the StringExtensions extension
Converts this string tocamelCase. -
toKebabCase(
) → String -
Available on String, provided by the StringExtensions extension
Converts this string tokebab-case. -
toPascalCase(
) → String -
Available on String, provided by the StringExtensions extension
Converts this string toPascalCase. -
toSnakeCase(
) → String -
Available on String, provided by the StringExtensions extension
Converts this string tosnake_case. -
toTitleCase(
) → String -
Available on String, provided by the StringExtensions extension
Converts this string to Title Case. -
truncate(
int maxLength, {String suffix = '…'}) → String -
Available on String, provided by the StringExtensions extension
Truncates this string to at mostmaxLengthcharacters.