toJson method

Map<String, Object> toJson()

Return a table representing the structure of the Json object that will be sent to the server to represent this response.

Implementation

Map<String, Object> toJson() {
  var jsonObject = <String, Object>{};
  jsonObject[ID] = id;
  jsonObject[METHOD] = method;
  if (params.isNotEmpty) {
    jsonObject[PARAMS] = params;
  }
  final serverRequestTime = this.serverRequestTime;
  if (serverRequestTime != null) {
    jsonObject[SERVER_REQUEST_TIME] = serverRequestTime;
  }
  return jsonObject;
}