getCoinData method

Future getCoinData()

Implementation

Future getCoinData() async {
  String dataBody = '';
  var jsonResponse;

  http.Response dataResponse = await http.post(urlAPI!,
      headers: <String, String>{
        'Content-Type': 'application/json; charset=UTF-8',
      },
      body: bodyObj);

  if (dataResponse.statusCode == 200) {
    print('HOLA');
    print(dataResponse.body);
    // var jsonRx = convert.;
    dataBody = dataResponse.body;
    jsonResponse = jsonDecode(dataBody);
    return jsonResponse;
  } else {
    print('CHAO');
    dataBody = dataResponse.statusCode.toString();
  }
  print(dataBody);
}