fromCode static method

ParticipationStatus fromCode(
  1. String code
)

Returns the participation status based on the string code, and throws an exception if no match is found.

Implementation

static ParticipationStatus fromCode(String code) => switch (code) {
      ('accepted') => ParticipationStatus.accepted,
      ('declined') => ParticipationStatus.declined,
      ('tentative') => ParticipationStatus.tentative,
      ('needs-action') => ParticipationStatus.needsAction,
      _ => throw Exception('Unknown ParticipationStatus code $code'),
    };