fetchSubscriptionData method
Future
fetchSubscriptionData(
{ - 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;
}