dartCoreAdapter top-level property
Covers support for Dart core types
Implementation
final dartCoreAdapter =
JsonMapperAdapter(title: 'Dart Core Adapter', typeInfoDecorators: {
0: defaultTypeInfoDecorator
}, converters: {
RegExp: regExpConverter,
Uri: uriConverter,
dynamic: defaultConverter,
String: defaultConverter,
bool: defaultConverter,
Enum: defaultEnumConverter,
Symbol: symbolConverter,
DateTime: dateConverter,
Duration: durationConverter,
num: numberConverter,
int: numberConverter,
double: numberConverter,
BigInt: bigIntConverter,
List: defaultIterableConverter,
Set: defaultIterableConverter,
Map: mapConverter,
Uint8List: uint8ListConverter
}, valueDecorators: {
typeOf<Map<String, dynamic>>(): (value) => value.cast<String, dynamic>(),
typeOf<List<Uri>>(): (value) => value.cast<Uri>(),
typeOf<List<RegExp>>(): (value) => value.cast<RegExp>(),
typeOf<List<String>>(): (value) => value.cast<String>(),
typeOf<List<DateTime>>(): (value) => value.cast<DateTime>(),
typeOf<List<Duration>>(): (value) => value.cast<Duration>(),
typeOf<List<num>>(): (value) => value.cast<num>(),
typeOf<List<int>>(): (value) => value.cast<int>(),
typeOf<List<double>>(): (value) => value.cast<double>(),
typeOf<List<bool>>(): (value) => value.cast<bool>(),
typeOf<List<Symbol>>(): (value) => value.cast<Symbol>(),
typeOf<List<BigInt>>(): (value) => value.cast<BigInt>(),
typeOf<Set>(): (value) =>
value is! Set && value is Iterable ? Set.from(value) : value,
typeOf<Set<Uri>>(): (value) => value.cast<Uri>(),
typeOf<Set<RegExp>>(): (value) => value.cast<RegExp>(),
typeOf<Set<String>>(): (value) => value.cast<String>(),
typeOf<Set<DateTime>>(): (value) => value.cast<DateTime>(),
typeOf<Set<Duration>>(): (value) => value.cast<Duration>(),
typeOf<Set<num>>(): (value) => value.cast<num>(),
typeOf<Set<int>>(): (value) => value.cast<int>(),
typeOf<Set<double>>(): (value) => value.cast<double>(),
typeOf<Set<bool>>(): (value) => value.cast<bool>(),
typeOf<Set<Symbol>>(): (value) => value.cast<Symbol>(),
typeOf<Set<BigInt>>(): (value) => value.cast<BigInt>(),
typeOf<Uint8List>(): (value) => Uint8List.fromList(value.cast<int>()),
typeOf<List<Uint8List>>(): (value) => value.cast<Uint8List>(),
});