import 'package:shared_preferences/shared_preferences.dart'; import 'package:uuid/uuid.dart'; class DeviceId { static const _key = 'tasq_device_id'; /// Returns a stable UUID for this installation. Generated once and persisted /// in `SharedPreferences`. static Future getId() async { final prefs = await SharedPreferences.getInstance(); var id = prefs.getString(_key); if (id != null && id.isNotEmpty) return id; id = const Uuid().v4(); await prefs.setString(_key, id); return id; } /// For testing or explicit reset. static Future reset() async { final prefs = await SharedPreferences.getInstance(); await prefs.remove(_key); } }