toJson method

String toJson()

Converts the response to JSON.

Implementation

String toJson() {
  final Map<String, dynamic> json = {
    'success': success,
  };

  if (data != null) json['data'] = data;
  if (error != null) json['error'] = error;
  if (message != null) json['message'] = message;
  if (statusCode != null) json['status_code'] = statusCode;

  return jsonEncode(json);
}