Task.fromJson constructor
Implementation
factory Task.fromJson(Map<String, dynamic> json) {
return Task(
clientId: json["client_id"],
id: json["id"],
compVarsCnd: json["comp_vars_cnd"],
completionCnd: json["completion_cnd"],
createdAt: DateTime.tryParse(json["created_at"] ?? ""),
createdBy: json["created_by"],
delay: json["delay"],
endsAt: json["ends_at"],
eventTrigger: json["event_trigger"] == null
? null
: EventTrigger.fromJson(json["event_trigger"]),
last: json["last"],
lastUpdatedBy: json["last_updated_by"],
parentTaskId: json["parent_task_id"],
platform: json["platform"] == null
? []
: List<int>.from(json["platform"]!.map((x) => x)),
prevTaskId: json["prev_task_id"],
recurrence: json["recurrence"] == null
? null
: Recurrence.fromJson(json["recurrence"]),
settings:
json["settings"] == null ? null : Settings.fromJson(json["settings"]),
startsAt: DateTime.tryParse(json["starts_at"] ?? ""),
status: json["status"],
timezone: json["timezone"],
type: json["type"],
updatedAt: DateTime.tryParse(json["updated_at"] ?? ""),
userTrigger: json["user_trigger"] == null
? null
: EventTrigger.fromJson(json["user_trigger"]),
variants: json["variants"] == null
? []
: List<Variant>.from(
json["variants"]!.map((x) => Variant.fromJson(x))),
vars: json["vars"] == null ? null : TaskVars.fromJson(json["vars"]),
events: json["events"] == null
? []
: List<String>.from(json["events"]!.map((x) => x)),
);
}