Tambahkan CounterService untuk manajemen counter di seluruh modul

- Buat CounterService untuk mengelola counter di berbagai controller
- Refaktor PetugasDesaController dan PenitipanBantuanController untuk menggunakan CounterService
- Perbarui binding untuk mendaftarkan CounterService
- Tambahkan metode update untuk berbagai jenis counter
- Sederhanakan manajemen state dengan menggunakan layanan pusat
This commit is contained in:
Khafidh Fuadi
2025-03-12 07:32:33 +07:00
parent 9995239115
commit 8a3b23d4ea
5 changed files with 165 additions and 54 deletions

View File

@ -8,6 +8,7 @@ import 'package:penyaluran_app/app/modules/petugas_desa/controllers/pengaduan_co
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/penerima_bantuan_controller.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/laporan_controller.dart';
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/counter_service.dart';
class PetugasDesaBinding extends Bindings {
@override
@ -17,6 +18,11 @@ class PetugasDesaBinding extends Bindings {
Get.put(AuthController(), permanent: true);
}
// Daftarkan CounterService terlebih dahulu
if (!Get.isRegistered<CounterService>()) {
Get.put(CounterService(), permanent: true);
}
// Main controller - gunakan put dengan permanent untuk controller utama
if (!Get.isRegistered<PetugasDesaController>()) {
Get.put(PetugasDesaController(), permanent: true);