JsonCodec class

Constructors

JsonCodec()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

jsonDecode(Object source, {Object? reviver(Object? key, Object? value)?, JsonDecodeOptions? options}) → dynamic
source may be a String, or raw bytes (List<int>) e.g. straight off an HTTP response — passing bytes directly is what lets malformed-UTF-8 string fields fall back to a raw List<int> instead of throwing.
jsonDecodeBytes(List<int> bytes, {Object? reviver(Object? key, Object? value)?, JsonDecodeOptions? options}) → dynamic
Decodes JSON directly from raw bytes (List<int>) — no String conversion involved, so this is the direct binary-in counterpart to jsonEncodeBytes. This is exactly what jsonDecode does internally when given a List<int>; use this version when you always have bytes and want a signature that says so. See jsonDecode for reviver and options.
jsonEncode(Object? object, {Object? toEncodable(Object? object)?, JsonEncodeOptions? options, String? indent}) → String
options is fully optional: leave it null (the default) for behavior identical to dart:convert's jsonEncode - pass one to opt into the BigInt/JsonBinary features (see the library doc above).
jsonEncodeBytes(Object? object, {Object? toEncodable(Object? object)?, JsonEncodeOptions? options, String? indent}) → BuBytes
Encodes directly to raw bytes — no intermediate String involved. This is the direct binary-out counterpart to jsonDecodeBytes/jsonDecode. See jsonEncode for options and indent.