mergeFromJson method

void mergeFromJson (String data, [ ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY ])

Merges field values from data, a JSON object, encoded as described by GeneratedMessage.writeToJson.

Implementation

void mergeFromJson(String data,
    [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) {
  /// Disable lazy creation of Dart objects for a dart2js speedup.
  /// This is a slight regression on the Dart VM.
  /// TODO(skybrian) we could skip the reviver if we're running
  /// on the Dart VM for a slight speedup.
  final jsonMap =
      jsonDecode(data, reviver: _emptyReviver) as Map<String, dynamic>;
  _mergeFromJsonMap(_fieldSet, jsonMap, extensionRegistry);
}