fromMap static method

URLProtectionSpace? fromMap(
  1. Map<String, dynamic>? map
)

Implementation

static URLProtectionSpace? fromMap(Map<String, dynamic>? map) {
  if (map == null) {
    return null;
  }
  List<X509Certificate>? iosDistinguishedNames;
  if (map["iosDistinguishedNames"] != null) {
    iosDistinguishedNames = <X509Certificate>[];
    (map["iosDistinguishedNames"].cast<Uint8List>() as List<Uint8List>)
        .forEach((data) {
      try {
        iosDistinguishedNames!.add(X509Certificate.fromData(data: data));
      } catch (e, stacktrace) {
        print(e);
        print(stacktrace);
      }
    });
  }

  return URLProtectionSpace(
    host: map["host"],
    protocol: map["protocol"],
    realm: map["realm"],
    port: map["port"],
    sslCertificate: SslCertificate.fromMap(
        map["sslCertificate"]?.cast<String, dynamic>()),
    sslError: SslError.fromMap(map["sslError"]?.cast<String, dynamic>()),
    iosAuthenticationMethod:
        IOSNSURLProtectionSpaceAuthenticationMethod.fromValue(
            map["iosAuthenticationMethod"]),
    iosDistinguishedNames: iosDistinguishedNames,
    iosReceivesCredentialSecurely: map["iosReceivesCredentialSecurely"],
    iosIsProxy: map["iosIsProxy"],
    iosProxyType:
        IOSNSURLProtectionSpaceProxyType.fromValue(map["iosProxyType"]),
  );
}