getDefaultUserProperties method

Future<Map<String, Object?>> getDefaultUserProperties()

Implementation

Future<Map<String, Object?>> getDefaultUserProperties() async {
  final Map<String, Object?> result = {};

  await _lock.synchronized(() {
    result['geo'] = Map<String, Object?>.from(_geoInfoProperties);
  });

  try {
    final String? deviceJson = Prefs.getString(devicePropertiesKey);
    final String? appJson = Prefs.getString(appPropertiesKey);

    if (deviceJson != null) {
      result['device'] = jsonDecode(deviceJson);
    } else {
      result['device'] = {};
    }

    if (appJson != null) {
      final appProps = jsonDecode(appJson) as Map<String, Object?>;
      result.addAll(appProps);
    }
  } catch (e, st) {
    dbLogger.severe('Error decoding stored properties', e, st);
  }

  return result;
}