TypeParser class

Lenient parsers for basic Dart types.

Constructors

TypeParser()

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 if type is Object or dynamic.
isCollectionType<T>([Type? type]) → bool
Returns true if type is a collection (List, Iterable, Map or Set).
isCollectionValue(Object value) → bool
Returns true if value is a collection (List, Iterable, Map or Set).
isPrimitiveType<T>([Type? type]) → bool
Returns true if type is primitive (String, int, double, num or bool).
isPrimitiveValue(Object value) → bool
Returns true if value 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 or type.
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 parserFor type. Returns value if can't parse.