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 or BigInt.
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 or BigInt 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 to BigInt or throws FormatException if cannot convert.
toBoolValue(Object? data) bool
Converts data to bool or throws FormatException if cannot convert.
toDoubleValue(Object? data, {double? min, double? max}) double
Converts data to double 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 to int 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 of K to V?, or throws if cannot convert.
toNullableValueOf<T extends Object>(Object? data) → T?
Converts data to a value of T? or throws if cannot convert.
toNullableValuesOf<T extends Object>(Iterable<Object?> list, {bool isExposed = false}) Iterable<T?>
Converts list to a value iterable of T? or throws if cannot convert.
toNumValue(Object? data, {num? min, num? max}) num
Converts data to num or throws FormatException if cannot convert.
toStringValue(Object? data) String
Converts data to String or throws FormatException if cannot convert.
toTimeMillisUTCValue(Object? data, {bool isUTCSource = false}) DateTime
Converts the data to a DateTime value.
toTimeUTCValue(Object? data, {DateFormat? sourceFormat, bool isUTCSource = false}) DateTime
Converts the data to a DateTime value.
toValueMapOf<K extends Object, V extends Object>(Map<K, Object?> map, {bool isExposed = false}) Map<K, V>
Converts map to a value map of K to V, or throws if cannot convert.
toValueOf<T extends Object>(Object? data) → T
Converts data to a value of T or throws FormatException if cannot.
toValuesOf<T extends Object>(Iterable<Object?> list, {bool isExposed = false}) Iterable<T>
Converts list to a value iterable of T 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.