toJson method

Map<String, Object> toJson()

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

Implementation

Map<String, Object> toJson() {
  var jsonObject = <String, Object>{};
  jsonObject[ID] = id;
  final error = this.error;
  if (error != null) {
    jsonObject[ERROR] = error.toJson();
  }
  jsonObject[REQUEST_TIME] = requestTime;
  final result = this.result;
  if (result != null) {
    jsonObject[RESULT] = result;
  }
  return jsonObject;
}