2
I have that code:
class _EstabelecimentosPageState extends State<EstabelecimentosPage> {
final String url = codeUrl;
@override void
initState() {
super.initState();
this.getJsonData();
}
Future<String> getJsonData() async {
var response = await http.get(url);
print("return " + response.body);
setState(() {
var convertDataToJson = json.decode(response.body);
var data = convertDataToJson['data']['codigo'];
return data;
});
return "Success";
}
}
That returns a
{"status":"success","data":{"codigo":"código"}}
I need to only take the "code" within the "date", but I’m not getting, I appreciate any help, I’m beginner and it’s giving me the nerve because I think it’s a simple mistake, but I can’t find.