wktToJson function
Converts a decoded WKT message value (snake_case proto field names) to its
proto3-JSON representation. resolver is the per-call Any resolver (unused
by the structural WKTs, threaded only for signature uniformity).
Implementation
Object? wktToJson(
String typeName,
Object? value,
Map<String, String>? features, [
AnyTypeResolver? resolver,
]) {
final wrapped = _wktWrappers[typeName];
if (wrapped != null) {
final v = (value is Map) ? value['value'] : null;
return fieldToJson(v ?? _scalarZero(wrapped), wrapped, features: features);
}
switch (typeName) {
case 'google.protobuf.Timestamp':
final m = _asWktMap(value);
_checkTimestampRange(m);
return timestampToRfc3339(m);
case 'google.protobuf.Duration':
final m = _asWktMap(value);
_checkDurationRange(m);
return durationToString(m);
case 'google.protobuf.FieldMask':
return _fieldMaskToJson(_asWktMap(value));
case 'google.protobuf.Struct':
return _structMsgToJson(_asWktMap(value));
case 'google.protobuf.Value':
return _valueMsgToJson(_asWktMap(value));
case 'google.protobuf.ListValue':
return _listValueMsgToJson(_asWktMap(value));
}
return value;
}