ConvertObject class abstract

A utility class for converting objects to different types.

Constructors

ConvertObject()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

toBigInt(dynamic object, {dynamic mapKey, int? listIndex}) BigInt
Converts an object to a BigInt.
toBool(dynamic object, {dynamic mapKey, int? listIndex}) bool
Converts an object to a bool.
toDateTime(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale, bool autoDetectFormat = false, bool useCurrentLocale = false, bool utc = false}) DateTime
Converts an object to a DateTime.
toDouble(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale}) double
Converts an object to a double.
toInt(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale}) int
Converts an object to an int.
toList<T>(dynamic object, {dynamic mapKey, int? listIndex}) List<T>
Converts an object to a List of type T.
toMap<K, V>(dynamic object, {dynamic mapKey, int? listIndex}) Map<K, V>
Converts an object to a Map with keys of type K and values of type V.
toNum(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale}) num
Converts an object to a num.
toSet<T>(dynamic object, {dynamic mapKey, int? listIndex}) Set<T>
Converts an object to a Set of type T.
toString1(dynamic object, {dynamic mapKey, int? listIndex}) String
Converts any object to a string if the object is not null.
toUri(dynamic object, {dynamic mapKey, int? listIndex}) Uri
Converts an object to a Uri.
tryToBigInt(dynamic object, {dynamic mapKey, int? listIndex}) BigInt?
Attempts to convert an object to a BigInt, or returns null if the object is null or conversion fails.
tryToBool(dynamic object, {dynamic mapKey, int? listIndex}) bool?
Attempts to convert an object to a bool, or returns null if the object is null or conversion is not applicable.
tryToDateTime(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale, bool autoDetectFormat = false, bool useCurrentLocale = false, bool utc = false}) DateTime?
Attempts to convert an object to a DateTime, or returns null if the object is null or conversion fails.
tryToDouble(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale}) double?
Attempts to convert an object to a double, or returns null if the object is null or conversion fails.
tryToInt(dynamic object, {dynamic mapKey, String? format, String? locale, int? listIndex}) int?
Attempts to convert an object to an int, or returns null if the object is null or conversion fails.
tryToList<T>(dynamic object, {dynamic mapKey, int? listIndex}) List<T>?
Attempts to convert an object to a List of type T, or returns null if conversion is not possible.
tryToMap<K, V>(dynamic object, {dynamic mapKey, int? listIndex}) Map<K, V>?
Attempts to convert an object to a Map with keys of type K and values of type V.
tryToNum(dynamic object, {dynamic mapKey, String? format, String? locale, int? listIndex}) num?
Attempts to convert an object to a num, or returns null if the object is null or conversion fails.
tryToSet<T>(dynamic object, {dynamic mapKey, int? listIndex}) Set<T>?
Attempts to convert an object to a Set of type T, or returns null if conversion is not possible.
tryToString(dynamic object, {dynamic mapKey, int? listIndex}) String?
Converts any object to a string, or returns null if the object is null.
tryToUri(dynamic object, {dynamic mapKey, int? listIndex}) Uri?
Attempts to convert an object to a Uri, or returns null if the object is null or conversion fails.