getGlobalProperties method

  1. @override
Future<Map<String, String>?> getGlobalProperties()
override

Retrieves global properties.

Implementation

@override
Future<Map<String, String>?> getGlobalProperties() async {
  Map<String, String> globalProperties = {};
  if (isLocalStorageSupported()) {
    globalProperties = getAllItemsWithNamespace(namespace);
  } else {
    String? cookie = document.cookie;
    if (cookie != null && cookie.isNotEmpty) {
      List<String> cookies = cookie.split(';');
      for (String cookieValue in cookies) {
        List<String> parts = cookieValue.trim().split('=');
        if (parts[0].startsWith(namespace)) {
          final namespacedKey = parts[0].substring(namespace.length);
          globalProperties[namespacedKey] = parts[1];
        }
      }
    }
    return null;
  }
  return globalProperties;
}