Skip to content

Rows doesn't get reponse data #51

Description

@arzukara

Hi,

I'm getting data from API like I wrote down.

 Future<String> getDataTableProvider(context) async {
    final response = await http.post(Uri.parse('https://**/DENEME.php'), body: {'tablename': 'TABLENAME'});

     rows = json.decode(response.body);
    print(rows);
    print("Data download successfully");
    return Future.value("Data download successfully");
  }

But Editable rows don't accept that row variable, turns rows as null. When I copy print of rows (print(rows);) and use it to define rows like;

rows = [
    {
      "name": 'James LongName Joe',
      "date": '23/09/2020',
      "month": 'June',
      "status": 'completed'
    },
    {
      "name": 'Daniel Paul',
      "month": 'March',
      "status": 'new',
      "date": '12/4/2020',
    },
    {
      "month": 'May',
      "name": 'Mark Zuckerberg',
      "date": '09/4/1993',
      "status": 'expert'
    },
    {
      "name": 'Jack',
      "status": 'legend',
      "date": '01/7/1820',
      "month": 'December',
    },
  ];

It works. I can get the same data with the same format when I use "json.decode(response.body)" but it doesn't work.
Why it could be?
(rows variable defined as List. And response has a right shape which package example requires.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions