const JsonEncoder([Object toEncodable(Object nonSerializable)])

Creates a JSON encoder.

The JSON encoder handles numbers, strings, booleans, null, lists and maps directly.

Any other object is attempted converted by toEncodable to an object that is of one of the convertible types.

If toEncodable is omitted, it defaults to calling .toJson() on the object.

Source

const JsonEncoder([Object toEncodable(Object nonSerializable)])
    : this.indent = null,
      this._toEncodable = toEncodable;