getPackagesList method

Future getPackagesList()

Implementation

Future getPackagesList() async {
  var decodedResponse;

  try {
    final response = await http.get(
      Uri.parse('${WELLNESS_URL}api/package/my-package-list'),
      headers: {'Authorization': currentUserToken},
    );

    decodedResponse = json.decode(response.body);

    if (decodedResponse['success'] == true) {
      packagesList = decodedResponse['active_package'];
    } else {
      Get.back();
    }
  } catch (e) {
    ErrorListner(
        apiname: 'pi/package/my-package-list',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}