writeToJson method Null safety
Returns a JSON string that encodes this message.
Each message (top level or nested) is represented as an object delimited by curly braces. Within a message, elements are indexed by tag number (surrounded by quotes). Repeated elements are represented as arrays.
Boolean values, strings, and floating-point values are represented as literals. Values with a 32-bit integer datatype are represented as integer literals; values with a 64-bit integer datatype (regardless of their actual runtime value) are represented as strings. Enumerated values are represented as their integer value.
For the proto3 JSON format use:
String writeToJson() => jsonEncode(writeToJsonMap());