class GenericResponse{ bool? status; String? message; GenericResponse.fromJson(Map json){ status = (json["code"] ?? "") != "0"; message = json["message"] ?? "Something went wrong"; } GenericResponse.withError(String err){ status = false; message = err; } } class GenericResponse2{ bool? status; String? message; GenericResponse2.fromJson(Map json){ status = (json["Code"] ?? "") != "0"; message = json["Message"] ?? "Something went wrong"; } GenericResponse2.withError(String err){ status = false; message = err; } }