MailAuthentication.fromJson constructor

MailAuthentication.fromJson(
  1. Map<String, dynamic> json
)

Creates a new MailAuthentication from the given json

Implementation

factory MailAuthentication.fromJson(Map<String, dynamic> json) {
  final authentication = json['authentication'] ?? json['typeName'];
  switch (authentication) {
    case 'plain':
      return PlainAuthentication.fromJson(json);
    case 'oauth':
    case 'oauth2':
      return OauthAuthentication.fromJson(json);
  }
  throw InvalidArgumentException(
    'unsupported MailAuthentication type [$authentication]',
  );
}