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,intorBigInt. - 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,intorBigIntdata. - 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
datatoBigIntor throws FormatException if cannot convert. -
toBoolValue(
Object? data) → bool -
Converts
datatoboolor throws FormatException if cannot convert. -
toDoubleValue(
Object? data, {double? min, double? max}) → double -
Converts
datatodoubleor throws FormatException if cannot convert. -
toIdValue(
Object? data) → Identifier -
Converts
datato Identifier or throws FormatException if cannot convert. -
toIntValue(
Object? data, {int? min, int? max}) → int -
Converts
datatointor throws FormatException if cannot convert. -
toNullableValueMapOf<
K extends Object, V extends Object> (Map< K, Object?> map, {bool isExposed = false}) → Map<K, V?> -
Converts
mapto a value map ofKtoV?, or throws if cannot convert. -
toNullableValueOf<
T extends Object> (Object? data) → T? -
Converts
datato a value ofT?or throws if cannot convert. -
toNullableValuesOf<
T extends Object> (Iterable< Object?> list, {bool isExposed = false}) → Iterable<T?> -
Converts
listto a value iterable ofT?or throws if cannot convert. -
toNumValue(
Object? data, {num? min, num? max}) → num -
Converts
datatonumor throws FormatException if cannot convert. -
toStringValue(
Object? data) → String -
Converts
datatoStringor throws FormatException if cannot convert. -
toTimeMillisUTCValue(
Object? data, {bool isUTCSource = false}) → DateTime -
Converts the
datato aDateTimevalue. -
toTimeUTCValue(
Object? data, {DateFormat? sourceFormat, bool isUTCSource = false}) → DateTime -
Converts the
datato aDateTimevalue. -
toValueMapOf<
K extends Object, V extends Object> (Map< K, Object?> map, {bool isExposed = false}) → Map<K, V> -
Converts
mapto a value map ofKtoV, or throws if cannot convert. -
toValueOf<
T extends Object> (Object? data) → T -
Converts
datato a value ofTor throws FormatException if cannot. -
toValuesOf<
T extends Object> (Iterable< Object?> list, {bool isExposed = false}) → Iterable<T> -
Converts
listto a value iterable ofTor 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.