TypeParser class
Lenient parsers for basic Dart types.
Constructors
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
-
isAnyType<
T> ([Type? type]) → bool -
Returns
true
iftype
is Object ordynamic
. -
isCollectionType<
T> ([Type? type]) → bool -
Returns
true
iftype
is a collection (List, Iterable, Map or Set). -
isCollectionValue(
Object value) → bool -
Returns
true
ifvalue
is a collection (List, Iterable, Map or Set). -
isPrimitiveType<
T> ([Type? type]) → bool -
Returns
true
iftype
is primitive (String, int, double, num or bool). -
isPrimitiveValue(
Object value) → bool -
Returns
true
ifvalue
is primitive (String, int, double, num or bool). -
parseBigInt(
Object? value, [BigInt? def]) → BigInt? - Tries to parse a BigInt.
-
parseBool(
Object? value, [bool? def]) → bool? - Tries to parse a bool.
-
parseDateTime(
Object? value, [DateTime? def]) → DateTime? - Tries to parse a DateTime.
-
parseDouble(
Object? value, [double? def]) → double? - Tries to parse a double.
-
parseDuration(
Object? value, [Duration? def]) → Duration? - Tries to parse a Duration.
-
parseInt(
Object? value, [int? def]) → int? - Tries to parse an int.
-
parseList<
T> (Object? value, {List< T> ? def, TypeElementParser<T> ? elementParser}) → List<T> ? - Tries to parse a List.
-
parseMap<
K, V> (Object? value, {Map< K, V> ? def, TypeElementParser<K> ? keyParser, TypeElementParser<V> ? valueParser}) → Map<K, V> ? - Tries to parse a Map.
-
parseMapEntry<
K, V> (Object? value, {MapEntry< K, V> ? def, TypeElementParser<K> ? keyParser, TypeElementParser<V> ? valueParser}) → MapEntry<K, V> ? - Tries to parse a MapEntry.
-
parseNum(
Object? value, [num? def]) → num? - Tries to parse a num.
-
parserFor<
T> ({Object? obj, Type? type, TypeInfo? typeInfo}) → TypeElementParser< T> ? -
Returns the parser for the desired type, defined by
T
,obj
ortype
. -
parserForTypeInfo<
T> (TypeInfo typeInfo) → TypeElementParser< T> ? -
parseSet<
T> (Object? value, {Set< T> ? def, TypeElementParser<T> ? elementParser}) → Set<T> ? - Tries to parse a Set.
-
parseString(
Object? value, [String? def]) → String? - Tries to parse a String.
-
parseUInt8List(
Object? value, [Uint8List? def]) → Uint8List? - Tries to parse a Uint8List.
-
parseValueForType<
V> (Type type, Object? value, [V? def]) → V? -
Parses
value
using a parserFortype
. Returnsvalue
if can't parse.