mergeFromProto3Json method Null safety

void mergeFromProto3Json(
  1. Object? json,
  2. {TypeRegistry typeRegistry = const TypeRegistry.empty(),
  3. bool ignoreUnknownFields = false,
  4. bool supportNamesWithUnderscores = true,
  5. bool permissiveEnums = false}
)

Merges field values from json, a JSON object using proto3 encoding.

Well-known types and their special JSON encodings are supported.

Throws FormatException if ignoreUnknownFields is false (the default) and an unknown field or enum name is encountered. Otherwise the unknown field or enum is ignored.

If supportNamesWithUnderscores is true (the default) field names in the JSON can be represented as either camel-case JSON-names or names with underscores. Otherwise only the JSON names are supported.

If permissiveEnums is true (default false) enum values in the JSON will be matched without case insensitivity and ignoring -s and _s. This allows JSON values like camelCase and kebab-case to match the enum values CAMEL_CASE and KEBAB_CASE.

In case of ambiguities between the enum values, the first matching value will be used.

The typeRegistry is used for decoding Any messages.

Throws FormatException if an Any message type is not in typeRegistry.

Throws FormatException if the JSON not formatted correctly (a String where a number was expected etc.).

Implementation

void mergeFromProto3Json(Object? json,
        {TypeRegistry typeRegistry = const TypeRegistry.empty(),
        bool ignoreUnknownFields = false,
        bool supportNamesWithUnderscores = true,
        bool permissiveEnums = false}) =>
    _mergeFromProto3Json(json, _fieldSet, typeRegistry, ignoreUnknownFields,
        supportNamesWithUnderscores, permissiveEnums);