parse static method

VParticipant parse(
  1. String vparticipantString
)

Implementation

static VParticipant parse(String vparticipantString) {
  late Role role;
  late MailTo email;
  String? name;

  if (vparticipantString.contains('mailto')) {
    final parts = vparticipantString.split(':');
    role = Role.values.firstWhere((e)=> Heplers.camelToSnake(e.name).toUpperCase() == parts[0].split(';')[0]);
    email = MailTo.parse(parts[1]) ;
    if (parts[0].contains('CN=')) {
      name = parts[0].split('CN=')[1];
    }
  }

  return VParticipant(
    role: role,
    email: email ,
    name: name,
  );
}