accessTokenWithExpDate property

Future<AccessTokenWithExpDate?> get accessTokenWithExpDate

Returns the current customer access token.

Implementation

Future<AccessTokenWithExpDate?> get accessTokenWithExpDate async {
  AccessTokenWithExpDate? accessTokenWithExpDate;
  if (_currentCustomerAccessToken.containsKey(ShopifyConfig.storeUrl)) {
    accessTokenWithExpDate = AccessTokenWithExpDate.fromJson(
      _currentCustomerAccessToken[ShopifyConfig.storeUrl]!,
    );
  } else {
    final _prefs = await SharedPreferences.getInstance();
    if (_prefs.containsKey(ShopifyConfig.storeUrl!)) {
      accessTokenWithExpDate = AccessTokenWithExpDate.fromJson(
        _prefs.getString(ShopifyConfig.storeUrl!)!,
      );
      _currentCustomerAccessToken[ShopifyConfig.storeUrl] =
          accessTokenWithExpDate.toJson();
    }
  }
  return accessTokenWithExpDate;
}