BackgroundEvent.fromMap constructor

BackgroundEvent.fromMap(
  1. Map map
)

Implementation

factory BackgroundEvent.fromMap(Map map) {
  final taskId = map["taskId"];
  if (taskId is! String && map["status"] is! String) {
    throw AssertionError("taskId : $taskId or status ${map["status"]} is null while parsing BackgroundEvent.fromMap");
  }
  final status = BtmTaskStatus.values.asNameMap()[map["status"]];
  if (status == null) throw AssertionError("status : ${map["status"]} is absent in BtmTaskStatus enums");
  return BackgroundEvent(
    taskId: taskId,
    tag: map["tag"],
    status: status,
    data: map["event"],
  );
}