i have a ElevatedButton like this
ElevatedButton(
onPressed: () {
setState(
() {
cetak("SELECT CUST_NAME FROM ts_custxm ");
},
);
},
child: Container(
width: 200,
child: Text(
"Cetak",
textAlign: TextAlign.center,
),
),
)
and this is my Cetak() Method
cetak(String query) async {
var req = await SqlConn.readData(query);
var parsedJson = jsonDecode(req);
debugPrint(res.toString());
setState(() {
res = parsedJson;
});
}
The problem is, when i want to query using cetak() i must trigger my ElevatedButton
is there any ways to query without using some button?
also im using SQL_CONN dependencies