CheckRun.fromJson constructor Null safety

CheckRun.fromJson(
  1. Map<String, dynamic> input
)

Implementation

factory CheckRun.fromJson(Map<String, dynamic> input) {
  CheckRunStatus? status;
  for (final s in const [
    CheckRunStatus.completed,
    CheckRunStatus.inProgress,
    CheckRunStatus.queued
  ]) {
    if (s.toString() == input['status']) {
      status = s;
      break;
    }
  }
  return CheckRun._(
    name: input['name'],
    id: input['id'],
    externalId: input['external_id'],
    status: status,
    headSha: input['head_sha'],
    checkSuiteId: input['check_suite']['id'],
    detailsUrl: input['details_url'],
    startedAt: DateTime.parse(input['started_at']),
  );
}