BackgroundTaskInfo.fromMap constructor

BackgroundTaskInfo.fromMap(
  1. Map map
)

Implementation

factory BackgroundTaskInfo.fromMap(Map<dynamic, dynamic> map) {
  final taskId = map['taskId'];
  if (taskId == null || taskId is! String) throw Exception("taskId error for $map");
  final handle = FunctionExt.fromRawHandle(map['handle']);
  if (handle == null || handle is! BackgroundTask) {
    throw HandleNotFoundException(rawHandle: map['handle'], message: "Handle : $handle");
  }
  debugPrint(" BtmTask.fromMap of $taskId args : ${map['args'].runtimeType}");
  return BackgroundTaskInfo(
    taskId: taskId,
    tag: map['tag'] is! String? ? null : map['tag'],
    handle: handle,
    args: map['args'] == null ? null : BackgroundDataFieldMapExt.fromMap(map['args']),
  );
}