Task.fromJson constructor
Creates a task from a Map. The task needs to have a type definition of either 'ordered' - OrderedTask or 'navigable' - NavigableTask. If not it will throw a TaskNotDefinedException.
Implementation
factory Task.fromJson(Map<String, dynamic> json) {
final type = json['type'];
if (type == 'ordered') {
return OrderedTask.fromJson(json);
} else if (type == 'navigable') {
return NavigableTask.fromJson(json);
}
throw TaskNotDefinedException();
}