fromMap static method
Gets a possible Cookie instance from a Map value.
Implementation
static Cookie? fromMap(Map<String, dynamic>? map, {EnumMethod? enumMethod}) {
if (map == null) {
return null;
}
final instance = Cookie(
domain: map['domain'],
expiresDate: map['expiresDate'],
isHttpOnly: map['isHttpOnly'],
isSecure: map['isSecure'],
isSessionOnly: map['isSessionOnly'],
name: map['name'],
path: map['path'],
sameSite: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => HTTPCookieSameSitePolicy.fromNativeValue(
map['sameSite'],
),
EnumMethod.value => HTTPCookieSameSitePolicy.fromValue(map['sameSite']),
EnumMethod.name => HTTPCookieSameSitePolicy.byName(map['sameSite']),
},
value: map['value'],
);
return instance;
}