JsonEncoder class abstract

A JSON encoder.

Inheritance

Constructors

JsonEncoder({JsonFieldMatcher? maskField, String maskText = '***', JsonFieldMatcher? removeField, bool removeNullFields = false, ToEncodableJsonProvider? toEncodableProvider, ToEncodableJson? toEncodable, JsonEntityCache? entityCache, bool forceDuplicatedEntitiesAsID = false, dynamic autoResetEntityCache = true})
factory

Properties

autoResetEntityCache bool
Returns true if the entity cache is automatically reset for each encoding session.
no setter
entityCache JsonEntityCache?
The JsonEntityCache of this encoder.
no setter
hashCode int
The hash code for this object.
no setterinherited
isStandard bool
Returns true if this instance's configuration is equivalent to the default configuration.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<Object?> stream) Stream<String>
Transforms the provided stream.
inherited
cast<RS, RT>() Converter<RS, RT>
Provides a Converter<RS, RT> view of this stream transformer.
inherited
convert(Object? input) String
Converts input and returns the result of the conversion.
inherited
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.
fuse<TT>(Converter<String, TT> other) Converter<Object?, TT>
Fuses this with other.
inherited
mapToJson(Map map, {bool duplicatedEntitiesAsID = false, bool? autoResetEntityCache}) Map<String, dynamic>
Converts map tree to a JSON.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetEntityCache() → void
Resets the entities cache used to resolve duplicated entities in the same tree.
startChunkedConversion(Sink<String> sink) Sink<Object?>
Starts a chunked conversion.
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

defaultEncoder JsonEncoder
final

Static Methods

callToJson(dynamic o, {Object? fallback(dynamic o)?}) Object?
Calls o.toJson in a performatic way, avoiding NoSuchMethodError and noSuchMethod calls.
getTypeToEncodable(Type type) ToEncodableJson?
registerTypeToEncodable(Type type, ToEncodableJson toEncodable) → void
removeTypeToEncodable(Type type) ToEncodableJson?