JsonObjectLite<E>.fromJsonString constructor

JsonObjectLite<E>.fromJsonString(
  1. String jsonString,
  2. [JsonObjectLite? t,
  3. bool recursive = true]
)

Eager constructor parses jsonString using JsonDecoder.

If t is given, will replace t's contents from the string and return t.

If recursive is true, replaces all maps recursively with JsonObjects. The default value is true. The object is set to immutable, the user must reset this to add more properties.

Implementation

factory JsonObjectLite.fromJsonString(String jsonString,
    [JsonObjectLite<dynamic>? t, bool recursive = true]) {
  t ??= JsonObjectLite<dynamic>();
  t._objectData = decoder.convert(jsonString);
  if (recursive) {
    t._extractElements(t._objectData);
  }
  t.isImmutable = true;
  return t as JsonObjectLite<E>;
}