utils/json library

Classes

JSON
Small helper to turn data into JSON and JSON back into data.

Properties

jsonBytesLent → bool
true while a result of jsonBytesView is not given back. For tests.
no setter
useSdkJsonEncoder ↔ bool
CoreFlags.sdkJsonEncoder of this isolate. Dox().initialize sets it, so an encode does not read the flags each time.
getter/setter pair

Functions

advanceEncode(dynamic object) → dynamic
forgetJsonWriters() → void
Forgets the writers that the encoder found. Dox().initialize() and the container call it when the DTOs or the writers change.
giveBackJsonBytes(List<int> view) → void
Gives back the buffer of jsonBytesView: call it when view is copied. Until then, every JSON encode of this isolate writes into a new buffer, so it can not change view.
jsonBytesView(Object? value) → Uint8List
value as JSON bytes with no copy, for the response of the native server. The result is a part of the encoder buffer: call giveBackJsonBytes when it is copied. All other code uses JSON.bytes.