toJson method

Map<String, dynamic> toJson()

Converts the Task instance to a JSON object.

Implementation

Map<String, dynamic> toJson() => {
      "name": name,
      "key": key,
      if (workflows != null) "workflows": workflows,
      "description": description,
      if (hooks.pre.isNotEmpty)
        "pre": hooks.pre.map((hook) => hook.toJson()).toList(),
      if (hooks.post.isNotEmpty)
        "post": hooks.post.map((hook) => hook.toJson()).toList(),
      "jobs": jobs.map((job) => job.toJson()).toList(),
    };