import 'package:fikoyt_ui/core/fiko_request.dart'; import 'package:fikoyt_ui/core/fikoyt_request_manager/fikoyt_request_engine.dart'; import 'package:get/get.dart'; class KullaniciService extends GetxService { Rx toplamlar = Rx({"kullanici": 0, "aktif_kullanici": 0, "deaktif_kullanici": 0, "sistem_kullanici": 0}); RxList kullanicilar = RxList([]); RxMap mesguller = RxMap({"kullaniciAliniyor": true, "toplamlarAliniyor": true}); // meguliyet late FikoYTRequestEngine> listeIstek; late FikoYTRequestEngine> toplamlarIstek; @override void onInit() { listeIstek = FikoYTRequestEngine>( command: "/uyar/admin/kullanicilar/liste", parameters: {"x": 1}, retryCount: 2, onEkOlsun: false, autoIsBusy: false, ) .onStart((self) { self.isBusy.value = true; // print("🚀 İşlem baslatıldı"); }) // .onProgress((e) => print("⏳ ${e.requestProgress?.percent}%")) .onResult((self, e) { kullanicilar.value = e.result; // print("✅ Veri Geldi: ${e.result}"); }) // .onError((e) => print("❌ Hatalar: ${e.list.map((x) => x.message).join(", ")}")) .onDone((self) async { await Future.delayed(Duration(seconds: 1)); self.isBusy.value = false; // mesguller["kullaniciAliniyor"] = false; // print("🏁 İşlem tamam"); }); toplamlarIstek = FikoYTRequestEngine>( command: "/uyar/admin/kullanicilar/toplamlar", parameters: {"x": 1}, retryCount: 2, onEkOlsun: false, ) .onStart((self) { mesguller["toplamlarAliniyor"] = true; // print("🚀 İşlem baslatıldı"); }) // .onProgress((e) => print("⏳ ${e.requestProgress?.percent}%")) .onResult((self, e) { toplamlar.value = e.result; // print("✅ Veri Geldi: ${e.result}"); }) // .onError((e) => print("❌ Hatalar: ${e.list.map((x) => x.message).join(", ")}")) .onDone((self) async { await Future.delayed(Duration(seconds: 1)); mesguller["toplamlarAliniyor"] = false; // print("🏁 İşlem tamam"); }); super.onInit(); } toplamlariAl() async { toplamlarIstek.start(); } kullanicilariAl() async { listeIstek.start(); // veya queue için: FikoYTRequestQueue().enqueue(() => ...start()); /** */ } }