2021年4月28日星期三

Can't get Future Value from DIO Flutter

I'm really new in Flutter programming.
I've problem while try to get value from Future. After I get it, I want to deserialize it for further processing.
The return value from the Future is on JSON Array.

Please help what should I do to solve this situation.

Kindly appreciate for your help.

class _MyAppState extends State<BodyWidget>  {    bool loading = true;    List<Widget> listArray = [];    Dio dio = new Dio();    dynamic isicontent = null;      Future<dynamic> getOrderHistory() async {      final String pathUrl = "http://p.q.r.s/mobile/QIXGetShipmentHistory/" + await FlutterSession().get("MobileUsername");      var responseDio = await dio.get(pathUrl, options: Options( headers: {'Content-Type': 'application/json; charset=UTF-8' } ) );        print(responseDio.data);  // It's works fine here...      return responseDio.data;    }      void renderIconShipmentOrderHistory()    {       var resultRespon = getOrderHistory();       print(resultRespon);   //the problem is here...    }  }  
https://stackoverflow.com/questions/67310419/cant-get-future-value-from-dio-flutter April 29, 2021 at 10:57AM

没有评论:

发表评论