getchanel method

Future<int> getchanel({
  1. String channelname = 'CUSTOM',
})

Implementation

Future<int> getchanel({String channelname = 'CUSTOM'}) async {
  var res = await http.get(
    Uri.parse('$baseurl/auth/login'),
    headers: <String, String>{
      'Content-Type': 'application/json',
      'Authorization': 'Bearer $shiprocketToken'
    },
  );

  var data = ChannelRes.fromJson(jsonDecode(res.body));
  var x = data.data!.where((element) => element.name == channelname).toList();
  return x[0].id!;
}