runtime library

Runtime support library imported by the generated *.easy.dart files.

This is not intended to be imported directly by application code — use package:dart_easy_json/easy_json.dart for the annotations and EasyIssue. It is public only so that generated code does not need to reach into src/.

Classes

EasyIssue

Functions

asBool(Object? v, {bool fallback = false}) → bool
asBoolOrNull(Object? v) → bool?
asDouble(Object? v, {double fallback = 0.0}) → double
asDoubleOrNull(Object? v) → double?
asInt(Object? v, {int fallback = 0}) → int
asIntOrNull(Object? v) → int?
Coerções básicas usadas no SAFE e no fast parse. Todas são "permissivas" e nunca lançam exceção.
asString(Object? v, {String fallback = ''}) → String
asStringOrNull(Object? v) → String?
coerceKeyIntOrNull(Object? k) → int?
Map key coercion
coerceKeyString(Object? k) → String
enumByNameOr<T extends Enum>(List<T> values, Object? v, T fallback) → T
Enums
mapListOrNull<T>(Object? raw, ListItemMapper<T> f) → List<T>?
mapMapOrNull<K, V>(Object? raw, MapEntryMapper<K, V> f) → Map<K, V>?
mapSetOrNull<T>(Object? raw, SetItemMapper<T> f) → Set<T>?
parseDateTime(Object? v, {DateTime? fallback}) → DateTime
parseDateTimeOrNull(Object? v) → DateTime?
DateTime helpers

Typedefs

ListItemMapper<T> = T Function(int index, Object? raw)
Iteradores com índice (para List/Set/Map) — economizam código gerado
MapEntryMapper<K, V> = MapEntry<K, V>? Function(Object key, Object? value)
SetItemMapper<T> = T Function(int index, Object? raw)