import 'package:cheminova/controller/rd_get_order_service.dart';
import 'package:cheminova/controller/rd_get_single_service.dart';
import 'package:cheminova/models/get_rd_cancelled_model.dart';
import 'package:cheminova/models/rd_get_order_model.dart';
import 'package:cheminova/models/single_get_order_model.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'get_cancle_service.dart';

class GetRDCancleController extends  GetxController {
  var isLoading = true.obs; // Tracks the loading state
  var productRDList = <GetRdCancelledModel>[].obs;
  Future<void> getRDCancleProduct() async {
    try {
      SharedPreferences prefs = await SharedPreferences.getInstance();
      String? token = prefs.getString('token');
      //isLoading(true); // Start loading
      final  response = await GetCancleService().getRDCancleProduct(token!); // Fetch products from API
      if (response != null) {
        productRDList.assignAll(response); // Assign products to the observable list
      }
    } finally {
      isLoading(false); // End loading
    }
  }
}