Workflow.fromJson constructor

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

Implementation

factory Workflow.fromJson(Map<String, Object?> json) {
  return Workflow(
    created: DateTime.tryParse(json[r'created'] as String? ?? ''),
    description: json[r'description'] as String? ?? '',
    hasDraftWorkflow: json[r'hasDraftWorkflow'] as bool? ?? false,
    id: PublishedWorkflowId.fromJson(
        json[r'id'] as Map<String, Object?>? ?? const {}),
    isDefault: json[r'isDefault'] as bool? ?? false,
    operations: json[r'operations'] != null
        ? WorkflowOperations.fromJson(
            json[r'operations']! as Map<String, Object?>)
        : null,
    projects: (json[r'projects'] as List<Object?>?)
            ?.map((i) => ProjectDetails.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    schemes: (json[r'schemes'] as List<Object?>?)
            ?.map((i) => WorkflowSchemeIdName.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    statuses: (json[r'statuses'] as List<Object?>?)
            ?.map((i) => WorkflowStatus.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    transitions: (json[r'transitions'] as List<Object?>?)
            ?.map((i) =>
                Transition.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    updated: DateTime.tryParse(json[r'updated'] as String? ?? ''),
  );
}