ejson library
Classes
Extensions
- BoolEJsonEncoderExtension on bool
- DateTimeEJsonEncoderExtension on DateTime
- DBRefEJsonEncoderExtension on DBRef
- DefinedEJsonEncoderExtension on Defined
- DoubleEJsonEncoderExtension on double
- IntEJsonEncoderExtension on int
- KeyEJsonEncoderExtension on BsonKey
-
ListEJsonEncoderExtension
on List<
Object?> - MapEJsonEncoderExtension on Map
- NullableObjectEJsonEncoderExtension on Object?
- NullEJsonEncoderExtension on Null
- ObjectIdEJsonEncoderExtension on ObjectId
- StringEJsonEncoderExtension on String
- SymbolEJsonEncoderExtension on Symbol
- Uint8ListEJsonEncoderExtension on Uint8List
- UndefinedEJsonEncoderExtension on Undefined
- UuidEJsonEncoderExtension on Uuid
Constants
Properties
Functions
-
fromEJson<
T> (EJsonValue? ejson, {T? defaultValue}) → T -
Converts
ejson
to typeT
. -
fromEJsonString<
T> (String source) → T -
Parses
source
to EJsonValue and convert to typeT
. -
register<
T> (EJsonEncoder< T> encoder, EJsonDecoder<T> decoder, {Iterable<Type> ? superTypes}) → void -
Register custom EJSON
encoder
anddecoder
for a typeT
. The last registered codec pair for a given typeT
will be used. -
toEJson(
Object? value) → EJsonValue? -
Converts
value
to EJson -
toEJsonString(
Object? value) → String -
Converts
value
to EJson string
Typedefs
-
EJsonDecoder<
T> = T Function(EJsonValue? ejson) -
EJsonEncoder<
T> = EJsonValue? Function(T object) - EJsonValue = Object?
Exceptions / Errors
- InvalidEJson
- Thrown when a value cannot be decoded from ejson.
- MissingDecoder
- Thrown when no decoder is registered for a type.
- MissingEncoder
- Exception thrown when no encoder is registered for the type of a value.