ProtoGoogleValue.fromJson constructor

ProtoGoogleValue.fromJson(
  1. Map<String, dynamic> json, {
  2. ProtoJsonConfig config = DefaultProtoJsonConfig.defaultConfig,
})

Implementation

factory ProtoGoogleValue.fromJson(
  Map<String, dynamic> json, {
  ProtoJsonConfig config = DefaultProtoJsonConfig.defaultConfig,
}) {
  return ProtoGoogleValue(
    nullValue:
        json['null_value'] == null
            ? null
            : ProtoGoogleNullValue.fromValue(
              json['null_value'] is int ? json['null_value'] : 0,
            ),
    numberValue: (json['number_value'] as num?)?.toDouble(),
    stringValue: json['string_value'],
    boolValue: json['bool_value'],
    structValue:
        json['struct_value'] == null
            ? null
            : ProtoGoogleStruct.fromJson(
              (json['struct_value'] as Map).cast<String, dynamic>(),
            ),
    listValue:
        json['list_value'] == null
            ? null
            : ProtoGoogleListValue.fromJson(
              (json['list_value'] as Map).cast<String, dynamic>(),
            ),
  );
}