StringConversionExtensions extension
String common type conversions extensions
- on
Properties
- toBool → bool?
-
Attempts to convert the string to a boolean value. Supports "true" and "false", case-insensitive.
no setter
- toDate → DateTime?
-
Attempts to parse the string into a DateTime object.
Returns null if the parsing fails.
no setter
- toDecimal → Decimal?
-
Converts the string to a Decimal. Returns null if the conversion fails.
Requires the
decimal
package.no setter - toDouble → double?
-
Converts the string to a double. Returns null if the conversion fails.
no setter
-
toDoubleList
→ List<
double> -
Converts a comma-separated string into a List
no setter
- toInt → int?
-
Converts the string to an integer. Returns null if the conversion fails.
no setter
-
toIntList
→ List<
int> -
Converts a comma-separated string into a List
no setter
- toJson → dynamic
-
Attempts to decode the string as a JSON object. Returns null if decoding fails.
no setter
- toList → List
-
Attempts to decode the string as a List
no setter
- toNum → num?
-
Converts the string to a num (which can be either int or double).
Returns null if the conversion fails.
no setter
- toUri → Uri?
-
Converts the string to a Uri object. Returns null if the conversion fails or the URL is invalid.
no setter