Aus öffentlichen Paketdaten erstellte Orientierung.
Das shopify_flutter-Paket ermöglicht eine nahtlose Integration zwischen Flutter-Anwendungen und Shopify-Stores. Es bietet eine einfache API zum Abrufen von Produkten, Verwalten von Warenkörben, Verarbeiten von Bestellungen und Handhaben der Authentifizierung, wodurch die Erstellung von E-Commerce-Apps mit Echtzeitdaten aus Shopify erleichtert wird. Für Entwickler, die ihre Apps direkt mit dem Shopify-Ökosystem verbinden möchten, unterstützt es mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux. Das Paket vereinfacht gängige E-Commerce-Abläufe und gewährleistet Kompatibilität über Geräte hinweg.
Anwendungsfälle
Shopify-basierte Mobile-Apps erstellen
Produktkataloge in Flutter-Anwendungen integrieren
Aktivieren der In-App-Kassenfunktion
Synchronisieren von Inventardaten
Benutzerdefinierte Shops erstellen
Hauptmerkmale
Direkte Shopify-API-Konnektivität
Multiplattformunterstützung
Produkt- und Warenkorbverwaltung
Authentifizierungsverwaltung
Echtzeit-Daten-Synchronisierung
Geeignet für
Flutter-Entwickler, die E-Commerce-Apps erstellen
Teams, die mit Shopify-Stores integriert sind
Apps, die Produkt- und Bestellverwaltung erfordern
Hinweise
Gültige Shopify-Shop-Anmeldedaten erforderlich
Abhängig von der Netzwerkverbindung
Erforderliche ordnungsgemäße Fehlerbehandlung für API-Antworten
Kann zusätzliche Benutzeroberflächenkomponenten für die vollständige Funktionalität erfordern
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
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)