SmsProviderConfiguration.fromJson constructor

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

Implementation

factory SmsProviderConfiguration.fromJson(Map<String, dynamic> json) {
  if (json.containsKey('type')) {
    var smsProviderType = smsProviderTypeFromString(json['type']);
    switch (smsProviderType) {
      case SmsProviderType.AWS_SNS:
        return AwsSnsSmsProviderConfiguration.fromJson(json);
      case SmsProviderType.TWILIO:
        return TwilioSmsProviderConfiguration.fromJson(json);
    }
  } else {
    throw FormatException('Missing type!');
  }
}