toJson method

Map<String, dynamic> toJson()

Converts this Encoding object to a JSON map.

Implementation

Map<String, dynamic> toJson() {
  if (ref != null) {
    return {r'$ref': ref};
  }
  final map = _$EncodingToJson(this as _Encoding);
  if (allowReserved == null) {
    map.remove('allowReserved');
  }
  map.removeWhere(
    (key, value) =>
        value == null ||
        (value is Map && value.isEmpty) ||
        (value is List && value.isEmpty),
  );
  return map;
}