fetchSubscriptionData method

Future fetchSubscriptionData({
  1. bool forceFetch = false,
})

Implementation

Future<dynamic> fetchSubscriptionData({bool forceFetch = false}) async {
  SharedPreferences sharedPreferences = await DeviceStorage().getInstance();
  String subscriptionData =
      sharedPreferences.getString(DeviceStorage.subscriptionData) ?? "";

  if (subscriptionData.isEmpty || forceFetch) {
    subscriptionData = await NetworkHandler.getSubcription();
  }

  if (subscriptionData.isEmpty) {
    subscriptionData = notsubscribed;
  }
  await sharedPreferences.setString(
      DeviceStorage.subscriptionData, subscriptionData);
  return subscriptionData;
}