ConvertObject class abstract

A utility class for converting objects to different types.

Constructors

ConvertObject.new()

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? defaultValue, ElementConverter<BigInt>? converter}) BigInt
Converts an object to a BigInt.
toBool(dynamic object, {dynamic mapKey, int? listIndex, bool? defaultValue, ElementConverter<bool>? converter}) 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? defaultValue, ElementConverter<DateTime>? converter}) DateTime
Converts an object to a DateTime.
toDouble(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale, double? defaultValue, ElementConverter<double>? converter}) double
Converts an object to a double.
toInt(dynamic object, {dynamic mapKey, int? listIndex, String? format, String? locale, int? defaultValue, ElementConverter<int>? converter}) int
Converts an object to an int.
toList<T>(dynamic object, {dynamic mapKey, int? listIndex, List<T>? defaultValue, ElementConverter<T>? elementConverter}) List<T>
Converts an object to a List of type T.
toMap<K, V>(dynamic object, {dynamic mapKey, int? listIndex, Map<K, V>? defaultValue, ElementConverter<K>? keyConverter, ElementConverter<V>? valueConverter}) 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? defaultValue, ElementConverter<num>? converter}) num
Converts an object to a num.
toSet<T>(dynamic object, {dynamic mapKey, int? listIndex, Set<T>? defaultValue, ElementConverter<T>? elementConverter}) Set<T>
Converts an object to a Set of type T.
toString1(dynamic object, {dynamic mapKey, int? listIndex, String? defaultValue, ElementConverter<String>? converter}) String
Converts any object to a string if the object is not null.
toUri(dynamic object, {dynamic mapKey, int? listIndex, Uri? defaultValue, ElementConverter<Uri>? converter}) Uri
Converts an object to a Uri.
tryToBigInt(dynamic object, {dynamic mapKey, int? listIndex, BigInt? defaultValue, ElementConverter<BigInt>? converter}) 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? defaultValue, ElementConverter<bool>? converter}) 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? defaultValue, ElementConverter<DateTime>? converter}) 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? defaultValue, ElementConverter<double>? converter}) 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? defaultValue, ElementConverter<int>? converter}) 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>? defaultValue, ElementConverter<T>? elementConverter}) 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>? defaultValue, ElementConverter<K>? keyConverter, ElementConverter<V>? valueConverter}) 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? defaultValue, ElementConverter<num>? converter}) 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>? defaultValue, ElementConverter<T>? elementConverter}) 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? defaultValue, ElementConverter<String>? converter}) String?
Converts any object to a string, or returns null if the object is null.
tryToUri(dynamic object, {dynamic mapKey, int? listIndex, Uri? defaultValue, ElementConverter<Uri>? converter}) Uri?
Attempts to convert an object to a Uri, or returns null if the object is null or conversion fails.