fromMap static method
- Map<
String, dynamic> ? map, { - EnumMethod? enumMethod,
Gets a possible FetchRequest instance from a Map value.
Implementation
static FetchRequest? fromMap(
Map<String, dynamic>? map, {
EnumMethod? enumMethod,
}) {
if (map == null) {
return null;
}
final instance = FetchRequest(
body: map['body'],
cache: map['cache'],
credentials: _fetchRequestCredentialDeserializer(
map['credentials'],
enumMethod: enumMethod,
),
headers: map['headers']?.cast<String, dynamic>(),
integrity: map['integrity'],
keepalive: map['keepalive'],
method: map['method'],
mode: map['mode'],
redirect: map['redirect'],
referrer: map['referrer'],
referrerPolicy: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => ReferrerPolicy.fromNativeValue(
map['referrerPolicy'],
),
EnumMethod.value => ReferrerPolicy.fromValue(map['referrerPolicy']),
EnumMethod.name => ReferrerPolicy.byName(map['referrerPolicy']),
},
url: map['url'] != null ? WebUri(map['url']) : null,
);
instance.action = switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => FetchRequestAction.fromNativeValue(
map['action'],
),
EnumMethod.value => FetchRequestAction.fromValue(map['action']),
EnumMethod.name => FetchRequestAction.byName(map['action']),
};
return instance;
}