fromMap static method

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

Gets a possible URLRequest instance from a Map value.

Implementation

static URLRequest? fromMap(Map<String, dynamic>? map) {
  if (map == null) {
    return null;
  }
  final instance = URLRequest(
    allowsCellularAccess: map['allowsCellularAccess'],
    allowsConstrainedNetworkAccess: map['allowsConstrainedNetworkAccess'],
    allowsExpensiveNetworkAccess: map['allowsExpensiveNetworkAccess'],
    assumesHTTP3Capable: map['assumesHTTP3Capable'],
    attribution: URLRequestAttribution.fromNativeValue(map['attribution']),
    body: map['body'],
    cachePolicy: URLRequestCachePolicy.fromNativeValue(map['cachePolicy']),
    headers: map['headers']?.cast<String, String>(),
    httpShouldHandleCookies: map['httpShouldHandleCookies'],
    httpShouldUsePipelining: map['httpShouldUsePipelining'],
    iosAllowsCellularAccess: map['allowsCellularAccess'],
    iosAllowsConstrainedNetworkAccess: map['allowsConstrainedNetworkAccess'],
    iosAllowsExpensiveNetworkAccess: map['allowsExpensiveNetworkAccess'],
    iosCachePolicy:
        IOSURLRequestCachePolicy.fromNativeValue(map['cachePolicy']),
    iosHttpShouldHandleCookies: map['httpShouldHandleCookies'],
    iosHttpShouldUsePipelining: map['httpShouldUsePipelining'],
    iosMainDocumentURL: map['mainDocumentURL'] != null
        ? Uri.tryParse(map['mainDocumentURL'])
        : null,
    iosNetworkServiceType: IOSURLRequestNetworkServiceType.fromNativeValue(
        map['networkServiceType']),
    iosTimeoutInterval: map['timeoutInterval'],
    mainDocumentURL: map['mainDocumentURL'] != null
        ? WebUri(map['mainDocumentURL'])
        : null,
    method: map['method'],
    networkServiceType: URLRequestNetworkServiceType.fromNativeValue(
        map['networkServiceType']),
    timeoutInterval: map['timeoutInterval'],
    url: map['url'] != null ? WebUri(map['url']) : null,
  );
  return instance;
}