Role.fromString constructor

Role.fromString(
  1. String value
)

Implementation

factory Role.fromString(String value) {
  switch (value) {
    case 'moderator':
      return Role.moderator;
    case 'participant':
      return Role.participant;
    case 'visitor':
      return Role.visitor;
    case 'none':
      return Role.none;
    default:
      throw InvalidRoleException();
  }
}