setConfig static method
void
setConfig(})
Sets the config.
IMPORTANT: preferably call this inside the main function or at least before instantiating other Shopify classes.
Implementation
static void setConfig(
String storefrontAccessToken,
String storeUrl,
String storefrontApiVersion, {
Store? cacheStore,
}) {
_storefrontAccessToken = storefrontAccessToken;
_storeUrl = storeUrl;
_storefrontApiVersion = storefrontApiVersion;
_cacheStore = cacheStore;
_graphQLClient = GraphQLClient(
link: HttpLink(
'https://$_storeUrl/api/$_storefrontApiVersion/graphql.json',
defaultHeaders: {
'X-Shopify-Storefront-Access-Token': _storefrontAccessToken!,
},
),
cache: GraphQLCache(
store: _cacheStore,
),
);
}