toMap method

Map<String, dynamic> toMap({
  1. EnumMethod? enumMethod,
})

Converts instance to a map.

Implementation

Map<String, dynamic> toMap({EnumMethod? enumMethod}) {
  return {
    "allowsCellularAccess": allowsCellularAccess,
    "allowsConstrainedNetworkAccess": allowsConstrainedNetworkAccess,
    "allowsExpensiveNetworkAccess": allowsExpensiveNetworkAccess,
    "assumesHTTP3Capable": assumesHTTP3Capable,
    "attribution": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => attribution?.toNativeValue(),
      EnumMethod.value => attribution?.toValue(),
      EnumMethod.name => attribution?.name(),
    },
    "body": body,
    "cachePolicy": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => cachePolicy?.toNativeValue(),
      EnumMethod.value => cachePolicy?.toValue(),
      EnumMethod.name => cachePolicy?.name(),
    },
    "headers": headers,
    "httpShouldHandleCookies": httpShouldHandleCookies,
    "httpShouldUsePipelining": httpShouldUsePipelining,
    "mainDocumentURL": mainDocumentURL?.toString(),
    "method": method,
    "networkServiceType": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => networkServiceType?.toNativeValue(),
      EnumMethod.value => networkServiceType?.toValue(),
      EnumMethod.name => networkServiceType?.name(),
    },
    "timeoutInterval": timeoutInterval,
    "url": url?.toString(),
  };
}