AppRequest.fromJSON constructor
AppRequest.fromJSON(
- dynamic data
Implementation
AppRequest.fromJSON(data) {
try {
from = data["from"] ?? "";
to = data["to"] ?? "";
createdTime = data["createdTime"] ?? 0;
if(data["newOffer"] != null) {
newOffer = EventOffer.fromJSON(data["newOffer"]);
}
message = data["message"] ?? "";
unread = data["unread"] ?? "";
bandId = data["bandId"] ?? "";
eventId = data["eventId"] ?? "";
positionRequestedId = data["positionRequestedId"] ?? "";
instrument = data["instrument"] != null ? Instrument.fromJSON(data["instrument"]) : null;
percentageCoverage = double.parse((data["percentageCoverage"] ?? '0').toString());
distanceKm = data["distanceKm"] ?? 0;
requestDecision = EnumToString.fromString(RequestDecision.values, data["requestDecision"] ?? RequestDecision.pending.name) ?? RequestDecision.pending;
} catch (e) {
AppConfig.logger.e(e.toString());
}
}