StringExtensions extension

on

Properties

addSpaceAndCommaIfNotEmpty String

Available on String, provided by the StringExtensions extension

If string is not blankisNotBlank append the string with a ', '
no setter
asBool bool

Available on String, provided by the StringExtensions extension

Convert this string into boolean.
no setter
isNotBlank bool

Available on String, provided by the StringExtensions extension

Returns true if s is neither null, empty nor is solely made of whitespace characters.
no setter
showDashIfEmpty String

Available on String, provided by the StringExtensions extension

Add prefix if not empty else return empty string
no setter
toDOUBLE double

Available on String, provided by the StringExtensions extension

Parses the string as an int or 0 defaultDouble.
no setter
toINT int

Available on String, provided by the StringExtensions extension

Parses the string as an int or 0 defaultInt.
no setter

Methods

addPrefixIfNotEmpty(String prefix) String

Available on String, provided by the StringExtensions extension

Add prefix if not empty else return empty string
firstNChars({int n = 1}) String

Available on String, provided by the StringExtensions extension

this will give first n characters of string
lastNChars({int n = 1}) String

Available on String, provided by the StringExtensions extension

this will give last n characters of string
toColor() Color

Available on String, provided by the StringExtensions extension

Parse string to Color
toDateTime({dynamic context}) DateTime?

Available on String, provided by the StringExtensions extension

Parse string to DateTime or Null
toList() List

Available on String, provided by the StringExtensions extension

JSON String to List usingjson.decode
toMap() Map

Available on String, provided by the StringExtensions extension

JSON String to Map usingjson.decode
truncateMiddle({int maxChars = 3, String truncateKey = '...'}) String

Available on String, provided by the StringExtensions extension

Truncates a long String in the middle while retaining the beginning and the end.