AccountModel.fromJson constructor

AccountModel.fromJson(
  1. Map<String, dynamic> jsonMap
)

Creates instance of AccountModel with values read from json

Implementation

factory AccountModel.fromJson(Map<String, dynamic> jsonMap) {
  AccountModel acc = AccountModel();
  jsonMap.forEach((key, value) {
    if ((key == 'sipServer') && (value is String)) {
      acc.sipServer = value;
    } else if ((key == 'sipExtension') && (value is String)) {
      acc.sipExtension = value;
    } else if ((key == 'sipPassword') && (value is String)) {
      acc.sipPassword = value;
    } else if ((key == 'sipAuthId') && (value is String)) {
      acc.sipAuthId = value;
    } else if ((key == 'sipProxy') && (value is String)) {
      acc.sipProxy = value;
    } else if ((key == 'displName') && (value is String)) {
      acc.displName = value;
    } else if ((key == 'userAgent') && (value is String)) {
      acc.userAgent = value;
    } else if ((key == 'expireTime') && (value is int)) {
      acc.expireTime = value;
    } else if ((key == 'transport') && (value is int)) {
      acc.transport = SipTransport.from(value);
    } else if ((key == 'port') && (value is int)) {
      acc.port = value;
    } else if ((key == 'tlsCaCertPath') && (value is String)) {
      acc.tlsCaCertPath = value;
    } else if ((key == 'tlsUseSipScheme') && (value is bool)) {
      acc.tlsUseSipScheme = value;
    } else if ((key == 'rtcpMuxEnabled') && (value is bool)) {
      acc.rtcpMuxEnabled = value;
    } else if ((key == 'iceEnabled') && (value is bool)) {
      acc.iceEnabled = value;
    } else if ((key == 'instanceId') && (value is String)) {
      acc.instanceId = value;
    } else if ((key == 'ringTonePath') && (value is String)) {
      acc.ringTonePath = value;
    } else if ((key == 'keepAliveTime') && (value is int)) {
      acc.keepAliveTime = value;
    } else if ((key == 'rewriteContactIp') && (value is bool)) {
      acc.rewriteContactIp = value;
    } else if ((key == 'verifyIncomingCall') && (value is bool)) {
      acc.verifyIncomingCall = value;
    } else if ((key == 'forceSipProxy') && (value is bool)) {
      acc.forceSipProxy = value;
    } else if ((key == 'secureMedia') && (value is int)) {
      acc.secureMedia = SecureMedia.from(value);
    } else if ((key == 'stunServer') && (value is String)) {
      acc.stunServer = value;
    } else if ((key == 'turnServer') && (value is String)) {
      acc.turnServer = value;
    } else if ((key == 'turnUser') && (value is String)) {
      acc.turnUser = value;
    } else if ((key == 'turnPassword') && (value is String)) {
      acc.turnPassword = value;
    } else if ((key == 'xContactUriParams') && (value is Map)) {
      acc.xContactUriParams = Map<String, String>.from(value);
    } else if ((key == 'upgradeToVideo') && (value is int)) {
      acc.upgradeToVideo = UpgradeToVideoMode.from(value);
    } else if ((key == 'xheaders') && (value is Map)) {
      acc.xheaders = Map<String, String>.from(value);
    } else if ((key == 'aCodecs') && (value is List)) {
      acc.aCodecs = List<int>.from(value);
    } else if ((key == 'vCodecs') && (value is List)) {
      acc.vCodecs = List<int>.from(value);
    }
  });
  return acc;
}