Tsabit
Tsabit

Reputation: 55

Display a jsondata from database in flutter

so i have a method called cetak() like this

var res = "";

  Future<void> cetak(String query) async {
    var req = await SqlConn.readData(query);
    var parsedJson = jsonDecode(req);
    setState(() {
      res = parsedJson[0]['CUST_KELO'];
    });
  }

and im using cetak() method like this

cetak("SPS_SALEMISA_7 'MW','FB','11'")

the table in my database have so many column, and i want to display some of them, for example i want to display CUST_KELO column.

but when i want to display res in Text() widget, nothing is show, the code is

Text(res),

but in my debugConsole (im using VScode),

E/flutter ( 4539): ..."CUST_KELO":115, "CLXX_DEFA":1, "AREA_COMP":03, "WAXX_NMBR":6285852517258}]

and CUST_KELO value on debugconsole is same like in the database/

any idea how to display CUST_KELO Column in Text() widget

Upvotes: -1

Views: 70

Answers (1)

noxgood
noxgood

Reputation: 180

Check if setState() is called for the same widget that has text. Maybe you rebuild the parent but child is const Stateless widget.

Upvotes: 0

Related Questions