Skip to main content
crave_storefront_sdk is the official Dart client for Flutter mobile, web, and desktop storefronts. It exposes the same reviewed /api/v1/storefront contract as @craveup/storefront-sdk, with Dart-native models, cancellation, timeouts, and typed exceptions. It contains no UI, Flutter, or native runtime dependency.

Install the exact release

pubspec.yaml
Run flutter pub get. Dart-only consumers can run dart pub get instead.

Configure one environment and merchant

Use the exact sandbox API origin provided for your account in sandbox builds. Production and sandbox are separate deployments with separate environment variables, credentials, and data; do not add a runtime environment switch to a production app. The client accepts plain HTTP only for exact loopback hosts during local development. StorefrontSessionStore is application-owned. In production, implement it with encrypted platform storage and isolate records by the supplied API-origin, merchant, and location scope. The included InMemoryStorefrontSessionStore is only for tests and ephemeral demos. Keep customer JWTs in your authentication layer, not in the cart session store.

Check ordering readiness

Check availability before presenting an ordering action. This anonymous GET does not create a cart:

Handle typed failures

The exception contract excludes resolved URLs, headers, request bodies, customer data, and payment values. Cart mutations are never retried implicitly. After CART_CONFLICT, re-read the cart, reconcile the new revision, and let the shopper confirm the next mutation. Close the client when its application-level owner is disposed:

Build a Flutter storefront

Install the package, configure secure session storage, load a menu, and start an order.