toJson method

Map<String, dynamic> toJson()

Transforms the model to a valid json format

Implementation

Map<String, dynamic> toJson() {
  final map = {
    "status": status,
    "error": error,
    "message": message,
  };
  if (jsonNamingConvention == JsonNamingConvention.snakeCase) {
    map.addAll({"error_type": errorType});
  } else {
    map.addAll({"errorType": errorType});
  }

  return map;
}