fromMap static method

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

Implementation

static URLProtectionSpaceHttpAuthCredentials? fromMap(
    Map<String, dynamic>? map) {
  if (map == null) {
    return null;
  }

  List<URLCredential>? credentials;
  if (map["credentials"] != null) {
    credentials = <URLCredential>[];
    (map["credentials"].cast<Map<String, dynamic>>()
            as List<Map<String, dynamic>>)
        .forEach((element) {
      var credential = URLCredential.fromMap(element);
      if (credential != null) {
        credentials!.add(credential);
      }
    });
  }

  return URLProtectionSpaceHttpAuthCredentials(
    protectionSpace: map["protectionSpace"] != null
        ? URLProtectionSpace.fromMap(
            map["protectionSpace"]?.cast<String, dynamic>())
        : null,
    credentials: credentials,
  );
}