【问题标题】:Flutter Https Unhandled Exception: Invalid argument(s)Flutter Https 未处理异常:参数无效
【发布时间】:2021-05-17 12:09:35
【问题描述】:

我想在列表视图中显示数据(例如硬代码)

当我想得到它不工作的价值时

I/flutter ( 9640): [{"No":0,"interest":"0.00","balance":"11,000,000,000.00","principal":"0.00","Installment":"0.00","Status":true},{"No":1,"interest":"110,000,000.00","balance":"0.00","principal":"11,000,000,000.00","Installment":"11,110,000,000.00","Status":true}]
I/flutter ( 9640): true
E/flutter ( 9640): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Invalid argument(s)
E/flutter ( 9640): #0      _StringBase.+ (dart:core-patch/string_patch.dart:272:57)

这里是 FetchData 异步

 List<LoanModel> _loanmodel = <LoanModel>[];

  Future<LoanModel> _fetchData() async {
    setState(() {
      loading = true;
    });
    final response =
    await http.get("http://192.168.0.23/Api/loansimulation.php?periodtime=" + periodtime + "&interestpermonth=" + interestpermonth + "&loanamountrequest=" +loanamountrequest); //with hardcode working fine
    if (response.statusCode == 200) {
      final data = jsonDecode(response.body);
      setState(() {
        for (Map i in data) {
          _loanmodel.add(LoanModel.fromJson(i));
        }
        loading = false;
      });
    }
  }

如何从API中获取periodtime、interestpermonth和loanamountrequest的值,并根据flutter中的输入值获取值?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    所以我提到了下面的例子,你如何显示 data 你可以从这个函数fetch

        listView.Builder(
    
         itemcount=_loanmodel.length;
         builder(context,index)
        {
         return Container(
        child:Column(
        childern[
        Text(_loanmodel[index].balance)
        ])
        );
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-15
      • 2023-03-17
      • 2021-08-24
      • 1970-01-01
      • 1970-01-01
      • 2019-02-27
      • 1970-01-01
      • 2019-07-02
      相关资源
      最近更新 更多