getCookiePreferences method
Retrieves the current cookie preferences from platform storage.
Returns a map of cookie types to their consent status, or null if no preferences are stored.
Implementation
@override
Future<Map<String, dynamic>?> getCookiePreferences() async {
try {
final storage = html.window.localStorage;
final preferences = storage[_storageKey];
if (preferences == null) {
debugPrint('No cookie preferences found in local storage');
return null;
}
try {
return Map<String, dynamic>.from(
const JsonDecoder().convert(preferences),
);
} on FormatException catch (e) {
debugPrint('Error parsing cookie preferences: ${e.message}');
return null;
}
} on Exception catch (e) {
debugPrint('Error accessing local storage: $e');
return null;
}
}