我正在获取类型问题我没有做错什么,我正在尝试将数据存储在 GetX 控制器类中并使其可观察。
我的代码: -
import 'package:get/get.dart';
import '../Services/HttpService.dart';
import 'dart:convert';
class SelectedCardController extends GetxController{
var selectedProductList = List().obs;
@override
void onInit() async{
super.onInit();
getProductDetail();
}
selectedProduct() async {
try {
HttpService httpService = HttpService();
var response = await httpService.get('business', 'product', 'get', '6035de62bf7db17c5dfd9977');
Map<dynamic, dynamic> decodedResponse = json.decode(response);
print('res ----------------- $decodedResponse');
print(selectedProductList.runtimeType);
if (decodedResponse['code'] == 200) selectedProductList = decodedResponse['content'];
print("result ------ $selectedProductList");
}
catch (e) {print(e);}
}
感谢您的提前帮助