import 'package:get/get.dart'; import 'package:get_storage/get_storage.dart'; class NotifikasiController extends GetxController { final notifikasiList = >[].obs; final storage = GetStorage(); @override void onInit() { super.onInit(); loadNotifications(); } void loadNotifications() { final data = storage.read('notification_history'); if (data != null) { final sorted = List>.from(data.reversed); notifikasiList.value = sorted.where((item) => item['waktu'] != null && item['judul'] != null && item['deskripsi'] != null ).toList(); } } void hapusNotifikasi(String waktu) { final updatedList = List>.from(notifikasiList); updatedList.removeWhere((item) => item['waktu'] == waktu); notifikasiList.value = updatedList; // Simpan ke storage storage.write('notification_history', updatedList.reversed.toList()); } void hapusSemua() { notifikasiList.clear(); storage.write('notification_history', []); } }