updateCookies method
Implementation
Future<void> updateCookies(Map<String, dynamic> headers) async {
List<String>? cookies = headers[OdinNetworkHeader.setCookie];
if (cookies != null) {
Map<String, Cookie> newCookies = {};
for (String cookie in cookies) {
Cookie cookieInstance = Cookie.fromSetCookieValue(cookie);
newCookies[cookieInstance.name] = cookieInstance;
}
newCookies.forEach((key, value) {
_cookies[key] = value;
});
Map<String, dynamic> saveData = {};
_cookies.forEach((key, value) {
saveData[key] = value.value;
});
await Service.get<CacheService>().setString(
key: 'odin_network_route_cookies', value: json.encode(saveData));
}
}