LongTaskStatus.fromJson constructor

LongTaskStatus.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory LongTaskStatus.fromJson(Map<String, Object?> json) {
  return LongTaskStatus(
    ari: json[r'ari'] as String?,
    id: json[r'id'] as String? ?? '',
    name: LongTaskStatusName.fromJson(
        json[r'name'] as Map<String, Object?>? ?? const {}),
    elapsedTime: (json[r'elapsedTime'] as num?)?.toInt() ?? 0,
    percentageComplete: (json[r'percentageComplete'] as num?)?.toInt() ?? 0,
    successful: json[r'successful'] as bool? ?? false,
    finished: json[r'finished'] as bool? ?? false,
    messages: (json[r'messages'] as List<Object?>?)
            ?.map((i) =>
                Message.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    status: json[r'status'] as String?,
    errors: (json[r'errors'] as List<Object?>?)
            ?.map((i) =>
                Message.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    additionalDetails: json[r'additionalDetails'] != null
        ? LongTaskStatusAdditionalDetails.fromJson(
            json[r'additionalDetails']! as Map<String, Object?>)
        : null,
  );
}