values library
Value accessors, conversions (dynamic objects to typed values) and helpers.
Usage: import package:attributes/values.dart
Classes
- Identifier
-
An interface for an identifier of something, represented as
String
,int
orBigInt
. - Primitive
- A interface for a primitive value with type and null safe accessors for data.
-
PrimitiveAccessor<
K> -
An interface to access typed primitive values by keys of type
K
. - StringOrInteger
-
An interface for a value representing
String
,int
orBigInt
data. - Value
- An interface for a value with type and null safe accessors for data implementing Primitive.
-
ValueAccessor<
K> -
An interface to access typed values by keys of type
K
.
Mixins
-
ValueAccessorMixin<
K> - A base mixin with a partial implementation of ValueAccessor.
Functions
-
toBigIntValue(
Object? data, {BigInt? min, BigInt? max}) → BigInt -
Converts
data
toBigInt
or throws FormatException if cannot convert. -
toBoolValue(
Object? data) → bool -
Converts
data
tobool
or throws FormatException if cannot convert. -
toDoubleValue(
Object? data, {double? min, double? max}) → double -
Converts
data
todouble
or throws FormatException if cannot convert. -
toIdValue(
Object? data) → Identifier -
Converts
data
to Identifier or throws FormatException if cannot convert. -
toIntValue(
Object? data, {int? min, int? max}) → int -
Converts
data
toint
or throws FormatException if cannot convert. -
toNullableValueMapOf<
K extends Object, V extends Object> (Map< K, Object?> map, {bool isExposed = false}) → Map<K, V?> -
Converts
map
to a value map ofK
toV?
, or throws if cannot convert. -
toNullableValueOf<
T extends Object> (Object? data) → T? -
Converts
data
to a value ofT?
or throws if cannot convert. -
toNullableValuesOf<
T extends Object> (Iterable< Object?> list, {bool isExposed = false}) → Iterable<T?> -
Converts
list
to a value iterable ofT?
or throws if cannot convert. -
toNumValue(
Object? data, {num? min, num? max}) → num -
Converts
data
tonum
or throws FormatException if cannot convert. -
toStringValue(
Object? data) → String -
Converts
data
toString
or throws FormatException if cannot convert. -
toTimeMillisUTCValue(
Object? data, {bool isUTCSource = false}) → DateTime -
Converts the
data
to aDateTime
value. -
toTimeUTCValue(
Object? data, {DateFormat? sourceFormat, bool isUTCSource = false}) → DateTime -
Converts the
data
to aDateTime
value. -
toValueMapOf<
K extends Object, V extends Object> (Map< K, Object?> map, {bool isExposed = false}) → Map<K, V> -
Converts
map
to a value map ofK
toV
, or throws if cannot convert. -
toValueOf<
T extends Object> (Object? data) → T -
Converts
data
to a value ofT
or throws FormatException if cannot. -
toValuesOf<
T extends Object> (Iterable< Object?> list, {bool isExposed = false}) → Iterable<T> -
Converts
list
to a value iterable ofT
or throws if cannot convert.
Exceptions / Errors
- ConversionException
- A FormatException notifying about an unsupported conversion.
- InvalidValueException
- A FormatException notifying about an invalid value
- NullValueException
- A FormatException notifying about a null value.
- UndefinedValueException
- A FormatException notifying about an undefined or missing value.