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 encoding are supported.

If ignoreUnknownFields is false (the default) an FormatException is be thrown if 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. If false 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 _. 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 found.

The typeRegistry is be used for decoding Any messages. If an Any message encoding a type not in typeRegistry is encountered, a FormatException is thrown.

If the JSON is otherwise not formatted correctly (a String where a number was expected etc.) a FormatException is thrown.


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);