shopify_flutter 패키지는 Flutter 애플리케이션과 Shopify 스토어 간의 원활한 통합을 가능하게 합니다. 제품 조회, 장바구니 관리, 주문 처리 및 인증 처리를 위한 간단한 API를 제공하여 Shopify에서 실시간 데이터를 활용해 전자상거래 앱을 쉽게 구축할 수 있습니다. 개발자가 애플리케이션을 Shopify 생태계에 직접 연결하고자 할 때 적합하며, Android, iOS, Web, macOS, Windows, Linux 등 다양한 플랫폼을 지원합니다. 이 패키지는 일반적인 전자상거래 워크플로우를 단순화하면서도 기기 간 호환성을 유지합니다.
사용 사례
Shopify 기반 모바일 앱 만들기
Flutter 앱에 제품 카탈로그 통합하기
앱 내 결제 기능 활성화
재고 데이터 동기화
사용자 지정 스토어 만들기
주요 기능
직접적인 Shopify API 연결
다중 플랫폼 지원
제품 및 장바구니 관리
인증 처리
실시간 데이터 동기화
적합한 대상
Flutter 개발자들이 전자상거래 앱을 구축하고 있습니다
Shopify 스토어와 통합된 팀
제품 및 주문 관리가 필요한 앱
고려 사항
유효한 Shopify 스토어 자격 증명이 필요합니다
네트워크 연결에 따라 다릅니다
API 응답에 대한 적절한 오류 처리가 필요합니다
완전한 기능을 위해 추가적인 UI 구성 요소가 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
shopify_flutter
A flutter package that works as a bridge between your Shopify Store and Flutter Application.
Support
If you like the package and find it helpful, you can Buy Me MO:MO.
How To Use
Create a private app on your Shopify store. Please follow THIS DOC to get started with it.
While creating storefront api access token, makes sure to check all the api permissions as some queries and mutations require permission on objects like product tags.
First of all configure the ShopifyConfig like that:
voidmain() {
ShopifyConfig.setConfig(
storefrontAccessToken: '*******************',
storeUrl: '*****.myshopify.com',
// Optional | Needed only if needed to call admin api
adminAccessToken: "shpat_*******************",
// optional | default: 2026-07
storefrontApiVersion: '2026-07',
// optional | default: null
cachePolicy: CachePolicy.cacheAndNetwork,
// Store locale | default : en
language: 'en',
// optional | default: in-memory GraphQLCache()// Inject a custom GraphQLCache for the Storefront client (e.g. disk-backed// via HiveStore from graphql_flutter).
storefrontCache: GraphQLCache(store: awaitHiveStore.open()),
// optional | default: in-memory GraphQLCache()// Inject a custom GraphQLCache for the Admin client.
adminCache: GraphQLCache(store: awaitHiveStore.open(boxName: 'admin')),
// optional | default: 30s
queryRequestTimeout: constDuration(seconds: 30)
);
runApp(MyApp());
}
adminAccessToken is only required for admin api calls like deleteCustomer().
If you are not using that function, you may not need to provide it.
storefrontApiVersion default vesion is set to '2026-07'. This package requires 2026-07 or newer (the cart operations rely on fields added in 2026-07). Shopify supports each version for 12 months after release and then falls forward to the oldest supported version, so prefer keeping this current.
language defaults to 'en'. It is the default locale/language of the store. Only takes effect if the store supports provided language code.
storefrontCache / adminCache let you supply a GraphQLCache from graphql_flutter so query results can be persisted to disk (e.g. via HiveStore) and survive app restarts. When omitted, fresh in-memory caches are created as before.
These are the possible instances, each contains different methods which will help you with working with the Shopify Storefront API.
The goal is to make creating an mobile app from your Shopify website easier.
Error handling
Every method throws a ShopifyException when a call fails — whether Shopify
returned GraphQL/user errors, or the request never completed (no connectivity,
timeout, HTTP error). One catch covers both:
try {
final products = awaitShopifyStore.instance.getAllProducts();
} onShopifyExceptioncatch (e) {
// e.key -> the operation, e.g. 'cartLinesAdd'// e.errorKey -> the kind of error, e.g. 'userErrors'// e.errors -> the messages Shopify returnedprint(e);
}
ShopifyException is exported from package:shopify_flutter/shopify_flutter.dart.
Changed in 3.1.0. Failed requests previously threw a bare String — which
is not an Exception, so on Exception catch did not catch it, and for
connectivity errors the thrown value was an empty string with the real cause
discarded. If you relied on catching a String, switch to ShopifyException.
Code using a bare catch (e) keeps working.
ShopifyLocalization shopifyLocalizatoin = ShopifyLocalization.instance;
Future<Localization> getLocalization()
// Used to change currency units. eg: "US", "NP", "JP" etc. Only takes effect if the store supports provided currency.voidsetCountryCode(String? countryCode)
// Used to set language code, eg: "EN", "DE", "FIL", "ZH_CN" etc.voidsetLanguageCode(String? languageCode)
// Getters
countryCode // get the stored country code
languageCode // get the stored language code
Above you see the instance on top and the possible methods and functions which you can use.
Filter Products
filters is a Map of String and dynmaic. Filter by price and availability are availabe by default.
Example:
1. gets products with a price between 100 and 500
{"price": {"min":100, "max":500} }
2. gets products with a price between 100 and 500 which are available
{"price": {"min":100, "max":500}, "available": true} }
3. gets products with a variant option with name "color" and value "blue"
{ "variantOption": { "name": "color", "value": "blue" } }
Important:
If you add a new field to a model please consider also adding this to every mutation/query that is associated with the model.
Example: adding a new field to Cart means going through every cart query/mutation in lib/graphql_operations/storefront/ and adding it to each one.
(adding a new field to a Model also requires you to update the fromJson)