HookEvent.fromJson constructor

HookEvent.fromJson(
  1. String? event,
  2. Map<String, dynamic>? json
)

Implementation

factory HookEvent.fromJson(String? event, Map<String, dynamic>? json) {
  if (event == 'pull_request') {
    return PullRequestEvent.fromJson(json!);
  } else if (event == 'issues') {
    return IssueEvent.fromJson(json!);
  } else if (event == 'issue_comment') {
    return IssueCommentEvent.fromJson(json!);
  } else if (event == 'repository') {
    return RepositoryEvent.fromJson(json!);
  }
  return UnknownHookEvent(event, json);
}