import 'package:shared_preferences/shared_preferences.dart'; import 'profiles_feature_service.dart'; class RouteHashPreferences { static const String _hashSizeKey = 'route_hash_size'; static const int defaultHashSize = 1; static Future getHashSize() async { final prefs = await SharedPreferences.getInstance(); final value = prefs.getInt(ProfileStorageScope.scopedKey(_hashSizeKey)) ?? defaultHashSize; return _normalize(value); } static Future setHashSize(int value) async { final prefs = await SharedPreferences.getInstance(); await prefs.setInt( ProfileStorageScope.scopedKey(_hashSizeKey), _normalize(value), ); } static int normalizeSync(int value) => _normalize(value); static int _normalize(int value) { if (value < 1 || value > 3) { return defaultHashSize; } return value; } }