Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Https Unhandled Exception: Invalid argument(s)

Tags:

flutter

I want to show data in listview (example as hardcode) enter image description here

When I want to get the value it's not working

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)

here is FetchData async

 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;
      });
    }
  }

How to get the value of periodtime, interestpermonth and loanamountrequest from API and get value based on input value in flutter?

like image 869
Blanc Chen Avatar asked May 17 '21 12:05

Blanc Chen


1 Answers

So I mentioned the below example how can you show the data you can fetch from this function.

    listView.Builder(

     itemcount=_loanmodel.length;
     builder(context,index)
    {
     return Container(
    child:Column(
    childern[
    Text(_loanmodel[index].balance)
    ])
    );
    }
like image 138
Muhammad Arbaz Zafar Avatar answered Oct 19 '22 01:10

Muhammad Arbaz Zafar