Flutter SDK
Install, configure and use appcore_sdk, the headless Dart SDK for AppCore consumer apps.
On this page
appcore_sdk is the Dart package your consumer app uses to talk to its AppCore runtime: sign-in, sessions,
purchases, entitlements, push and inbox, remote config, analytics and privacy. The core is pure Dart (depends only on
http and timezone). Anything native (secure storage, StoreKit / Play Billing, FCM, Google / Apple sign-in, local
notifications) sits behind a small Dart interface ("bridge"), so you choose and own the plugins.
SDK version 0.1.0, built against AppCore contract 1.0.0. The constants sdkVersion and contractVersion are
exported from package:appcore_sdk/appcore_sdk.dart. The API is pre-1.0 and was still changing on 2026-11-30.
These pages describe the code as it stood then. Where they disagree with sdk/flutter/lib, the code is right.
New to AppCore? Start with Getting started. The HTTP endpoints behind each SDK call are in the API reference.
Guides
| Page | Covers |
|---|---|
| Platform setup | iOS and Android project setup each bridge needs: Firebase files, capabilities, Google / Apple sign-in, URL schemes |
| Authentication | Email / WhatsApp OTP, Google, Apple, sessions and persistence, guest use, account linking, sign-out |
| Purchases and entitlements | Catalog, native purchase flow, restore, entitlement cache, credits and balances |
| Messaging | Push permission and device registration, inbox, notification preferences, deep links, local reminders |
| Remote config and analytics | Client config with ETag caching, exposure events, consent-gated event queue, allowed event names |
| Privacy | Consent records, data export, account deletion |
| Errors and retries | AppCoreProblem, NextAction, FEATURE_UNAVAILABLE, what the SDK retries and with which idempotency key |
| Widgets | Optional unbranded widgets in package:appcore_sdk/widgets.dart |
| Testing and the reference app | Contract fixture server, staging smoke test, examples/flutter-reference |
What has been tested, and how
The WS10 status (2026-11-30) supports these claims and no stronger ones:
| Level | What it covers |
|---|---|
| Fixture-tested | 70 SDK tests run real HTTP against sdk/flutter/tool/fixture_server.dart. That server checks every request and response body against packages/contracts/schemas and fails a test on any contract violation, a missing x-request-id, or an effect sent without Idempotency-Key. This covers init, OTP and social sign-in, sessions, purchases, restore, entitlements, messaging, deep links, remote config, analytics, privacy and reminders. Account linking, subscriptions(), documents() and plans() are implemented but not covered, because the fixture server has no routes for them. |
| Tested against a real backend | One staging check: a forged bearer on /v1/entitlements/me returns a schema-valid 401 Problem. AppCore.init against staging has not completed yet, because staging public config was not published when the smoke test ran (it returned 503 FEATURE_UNAVAILABLE). |
| Device / provider-tested | None. No StoreKit, Play Billing, FCM/APNs, Google or Apple sign-in calls have been made. Android builds have not been run. The reference app runs on the iOS Simulator in fixture mode only. |
Warning
Not yet enabled: device and provider verification. Every native flow below (store purchase, push delivery and taps, Google / Apple sign-in) has only been exercised with fake bridges against the fixture server. Run the manual device checklist in Testing before you ship.
Install
The package is not published to pub.dev (publish_to: none in sdk/flutter/pubspec.yaml). Use a git or path
dependency.
# pubspec.yaml
environment:
sdk: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
dependencies:
appcore_sdk:
git:
url: <appcore-sdk-git-url>
path: sdk/flutter
ref: <tag-or-commit> # pin it; the SDK has no published versions yetFor a monorepo or a local checkout:
dependencies:
appcore_sdk:
path: ../path/to/sdk/flutterThe SDK adds no native plugins. You add the plugins your bridges use. The reference adapters in
examples/flutter-reference/lib/adapters/ were written against these versions:
dependencies:
flutter_secure_storage: ^9.2.2 # SecureStore
in_app_purchase: ^3.2.0 # StoreBridge (StoreKit 2 / Play Billing)
in_app_purchase_android: any
in_app_purchase_storekit: any
firebase_core: ^3.6.0 # PushBridge (FCM transport only)
firebase_messaging: ^15.1.3
google_sign_in: ^6.2.1 # SocialSignInBridge (google)
sign_in_with_apple: ^6.1.2 # SocialSignInBridge (apple)
crypto: ^3.0.3 # SHA-256 of the Apple nonce
flutter_local_notifications: ^18.0.1 # LocalNotificationsBridge (reminders)
timezone: ^0.10.1Copy the adapter files you need into your app. They are reference code, not part of the package.
Initialize
One binary targets one app and one environment. Use build flavors or --dart-define, never a runtime picker.
import 'dart:io' show Platform;
import 'package:appcore_sdk/appcore_sdk.dart';
Future<AppCore> startAppCore() {
return AppCore.init(
manifest: AppCoreManifest(
apiBaseUrl: Uri.parse(const String.fromEnvironment('API_BASE_URL')), // https://<your-api-host>
appId: '<your-app-id>',
environmentId: 'production', // development | staging | production
platformProvider: Platform.isIOS ? 'apple' : 'google_play',
deepLinkScheme: '<your-scheme>',
),
secureStorage: PlatformSecureStore(), // your SecureStore, e.g. the reference adapter
appVersion: '1.4.0',
locale: 'en',
timezone: 'Asia/Kolkata', // IANA name; DateTime.timeZoneName returns abbreviations like "IST"
);
}What AppCore.init does, in order:
manifest.validate(releaseMode: ...). It throwsArgumentErrorif the URL contains secret-looking text or credentials, ifenvironmentIdis not one of the three values, or (in release builds) if the URL is nothttpsor points atlocalhost,127.0.0.1or10.0.2.2. Plainhttpis accepted only for those local hosts in debug.GET /v1/config/public(unauthenticated, retried like any GET).- Throws
AppCoreProblemAPP_ENVIRONMENT_MISMATCHif the backend reports a differentapp_idorenvironment_id, andAPP_UPDATE_REQUIREDifsdkVersionis belowminimum_sdk_version. - Restores the stored session. A stored session scoped to another app or environment is wiped.
init parameters: manifest, secureStorage, appVersion (required); releaseMode (defaults to
dart.vm.product), httpClient, locale, timezone, clock, sleep (test hooks).
If the backend has not published public config for this app and environment, init throws a 503
FEATURE_UNAVAILABLE problem. The SDK does not retry it, so show a "try again later" state.
Public config and capabilities
core.publicConfig (PublicCapabilities) is read once at init. A change on the server is seen at the next app
start. Its fields are appId, environmentId, configVersion, authMethods, messagingChannels,
purchaseProviders, features, minimumSdkVersion, supportedLocales, supportUrl and privacyUrl.
core.capabilities wraps it with checks:
final caps = core.capabilities;
final showGoogle = caps.auth('google'); // email_otp | whatsapp_otp | google | apple
final showInbox = caps.channel('in_app'); // push | in_app | ...
final canBuyOnIos = caps.purchases('apple'); // apple | google_play
final streaks = caps.feature('<feature-key>');Only offer what is enabled. A disabled capability fails with FEATURE_UNAVAILABLE. It never pretends to succeed:
| Surface | When disabled |
|---|---|
core.commerce | Getter throws local FEATURE_UNAVAILABLE if purchaseProviders is empty |
core.messaging | Getter throws local FEATURE_UNAVAILABLE if neither push nor in_app is enabled |
auth.requestOtp, auth.signInWithSocial | Throw local FEATURE_UNAVAILABLE if the method is not in authMethods |
commerce.available() | false if the attached store's provider is not in purchaseProviders; purchase() then emits PurchaseStage.unavailable |
messaging.pushEnabled / inboxEnabled | false; permission() returns PushPermission.unavailable; registerDevice() does nothing |
| Everything else | The server answers 503 FEATURE_UNAVAILABLE when a provider is missing (for example email OTP with no email sender configured) |
The server side of this is described in Errors and retries.
Modules
All modules are created lazily on first access to the getter.
| Getter | Class | Endpoints |
|---|---|---|
core.auth | AuthClient | /v1/auth/otp/request, /otp/verify, /social, /me, /sessions, /methods, /methods/link, /methods/{id}, /contact-challenges, /contact-challenges/verify, /social-link-proof, /logout, /logout-all |
core.session | SessionManager | none (secure storage) |
core.entitlements | EntitlementsClient | GET /v1/entitlements/me |
core.commerce | CommerceClient | /v1/catalog/products, /v1/catalog/plans, /v1/commerce/purchase-intents, /purchases/verify, /restore, /subscriptions, /v1/jobs/{id}, /v1/finance/documents |
core.messaging | MessagingClient | PUT /v1/messaging/devices, DELETE /devices/{installation_id}, PUT /preferences, GET /inbox, POST /inbox/{id}/read |
core.remoteConfig | RemoteConfigClient | GET /v1/engagement/config/client |
core.analytics | Analytics | POST /v1/analytics/events |
core.privacy | PrivacyClient | POST /v1/privacy/consent, POST /v1/privacy/export, DELETE /v1/privacy/account, GET /v1/jobs/{id} |
core.deepLinks | DeepLinkPolicy | none (validates push payloads and app links) |
core.routeGate | PendingRouteGate | none (holds a route until sign-in) |
| (standalone) | ReminderPlanner | none (local notifications) |
AppCore also has logout({allDevices}), deleteAccount(), installationId() and dispose(). Use
core.logout() and core.deleteAccount() rather than the lower-level auth.logout() and
privacy.requestAccountDeletion(). The AppCore versions also flush analytics, detach the device and purge per-user
caches.
What the SDK does on every identity change
When the session's user changes (sign-in, switching accounts, a 401, sign-out or deletion), the SDK clears the
previous user's local state before anything else can read it. It drops queued analytics events that belong to other
users, clears the entitlement snapshot, the cached inbox and the remote config cache, and clears any pending deep-link
route on sign-out. After a sign-in it re-registers the device if core.messaging was already created.
Calls the contract has but the SDK does not wrap
These consumer endpoints exist in the API but have no SDK method yet. Call them through core.transport.send(...) if
you need them (see Errors and retries).
Warning
Not yet enabled in the SDK: GET /v1/commerce/purchases, GET /v1/commerce/purchases/{id},
GET /v1/commerce/purchase-intents/{id}, GET /v1/commerce/subscriptions/{id},
GET /v1/catalog/products/{id}, GET /v1/finance/documents/{id} and
POST /v1/finance/documents/{id}/download. Browser OAuth (/v1/auth/oauth/start, /v1/auth/browser-exchange)
is also missing; it is being written in lib/src/auth/browser_oauth.dart but is not exported yet. The
list methods the SDK does have (products, subscriptions, documents, inbox) cover the usual screens.