JsonCodec class

JSON codec integrated with ReflectionFactory.

Constructors

JsonCodec({JsonFieldMatcher? maskField, String maskText = '***', JsonFieldMatcher? removeField, bool removeNullFields = false, ToEncodableJsonProvider? toEncodableProvider, ToEncodableJson? toEncodable, JsonValueDecoderProvider? jsonValueDecoderProvider, JsomMapDecoderProvider? jsomMapDecoderProvider, JsomMapDecoder? jsomMapDecoder, JsomMapDecoderAsyncProvider? jsomMapDecoderAsyncProvider, JsomMapDecoderAsync? jsomMapDecoderAsync, IterableCaster? iterableCaster, MapCaster? mapCaster, JsonEntityCache? entityCache, bool forceDuplicatedEntitiesAsID = false, dynamic autoResetEntityCache = true})
factory

Properties

decoder JsonDecoder
The JsonDecoder of this instance.
final
encoder JsonEncoder
The JsonEncoder of this instance.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode<T>(String encodedJson, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) → T
Decodes encodedJson to a JSON collection/data.
decodeAsync<T>(FutureOr<String> encodedJson, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) FutureOr<T>
Decodes encodedJson to a JSON collection/data allowing async calls (Future and FutureOr).
decodeFromBytes<T>(Uint8List encodedJsonBytes, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) → T
Sames as decode but from a Uint8List.
decodeFromBytesAsync<T>(FutureOr<Uint8List> encodedJsonBytes, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) FutureOr<T>
Sames as decodeAsync but from a Uint8List.
encode(Object? o, {bool pretty = false, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) String
Transforms o to an encoded JSON.
encodeToBytes(Object? o, {bool pretty = false, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) Uint8List
Sames as encode but returns a Uint8List.
fromJson<O>(Object? o, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) → O?
Converts o to type.
fromJsonAsync<O>(Object? o, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) FutureOr<O?>
Converts o to type allowing async calls (Future and FutureOr).
fromJsonList<O>(Iterable o, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) List<O?>
Converts o to as List of type.
fromJsonListAsync<O>(FutureOr<Iterable> o, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) FutureOr<List<O?>>
Converts o to as List of type allowing async calls (Future and FutureOr).
fromJsonMap<O>(Map<String, Object?> map, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) → O
Converts map to type.
fromJsonMapAsync<O>(FutureOr<Map<String, Object?>> map, {Type? type, TypeInfo? typeInfo, bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) FutureOr<O>
Converts map to type allowing async calls (Future and FutureOr).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson<T>(Object? o, {bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) → T?
Converts o to a JSON collection/data.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultCodec JsonCodec
final