import 'package:fikoyt_ui/core/fiko_request.dart'; import 'package:fikoyt_ui/core/fikoyt_request_manager/fikoyt_request_engine.dart'; import 'package:fikoyt_ui/core/fikoyt_request_manager/fikoyt_request_queue.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([]); /** */ /** */ late FikoYTRequestEngine> listeIstek; late FikoYTRequestEngine> toplamlarIstek; late FikoYTRequestEngine ekleIstek; @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; // print("🏁 İşlem tamam"); }); toplamlarIstek = FikoYTRequestEngine>( command: "/uyar/admin/kullanicilar/toplamlar", 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) { 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)); self.isBusy.value = false; // print("🏁 İşlem tamam"); }); ekleIstek = FikoYTRequestEngine>( command: "/uyar/admin/kullanicilar/ekle", 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; // print("🏁 İşlem tamam"); }); super.onInit(); } toplamlariAl() async { toplamlarIstek.startWithQueue(tag: "toplamlariAl", priority: 1); } kullanicilariAl() async { listeIstek.startWithQueue(tag: "kullanicilarListe", priority: 10); // listeIstek.start(); // veya queue için: FikoYTRequestQueue().enqueue(() => ...start()); /** */ } }