Dart SDK for Feeef APIs and repositories.
This is the same pattern used by major providers (Google-style browser authorize + callback + token exchange).
Full HTTP reference (hosts, consent, PKCE, troubleshooting): Feeef backend
docs/OAUTH2_DEVELOPER.md (authoritative contract for third-party OAuth).
Use the accounts origin for the browser step (consent UI), not /v1 on the API. Hitting the API authorize URL still works (server redirects to accounts).
import 'package:feeef/apps/app_repository.dart';
final authorizeUrl = AppRepository.buildAuthorizeUrl(
baseUrl: 'https://accounts.feeef.org',
clientId: '<client_id>',
redirectUri: 'https://your-app.com/oauth/callback',
responseType: 'code',
scope: ['*'], // or explicit scopes
state: 'random_csrf_state',
);Open authorizeUrl in a browser/webview.
If the user is not logged in, non-browser clients may get JSON from /oauth/authorize; browsers are usually redirected to sign-in. Example body:
{
"error": "login_required",
"error_description": "User must log in to authorize the application",
"login_url": "https://accounts.feeef.org/signin?next=...",
"next": "https://accounts.feeef.org/oauth/authorize?..."
}Navigate to login_url. After sign-in, continue the authorize step.
The browser is redirected to your registered redirect_uri with query params:
codestate(if provided)
Validate state.
Use the SDK repository:
import 'package:feeef/feeef.dart';
final oauth = Feeef.instance.oauth;
final tokenResponse = await oauth.exchangeAuthorizationCode(
code: codeFromCallback,
redirectUri: 'https://your-app.com/oauth/callback',
clientId: '<client_id>',
clientSecret: '<client_secret>',
// codeVerifier: '<pkce_verifier>', // if PKCE was used
);The SDK also supports:
await oauth.revokeToken(token: tokenResponse.accessToken);
final introspection = await oauth.introspectToken(
token: tokenResponse.accessToken,
);Underlying HTTP contract:
POST https://api.feeef.org/v1/oauth/tokenContent-Type: application/x-www-form-urlencoded
Required fields:
grant_type=authorization_codecoderedirect_uriclient_idclient_secret
Optional (PKCE):
code_verifier
- Keep
client_secretserver-side only. - Validate
stateon callback. - Use PKCE for public clients.
- Ensure
redirect_uriexactly matches one registered in the app.
Dart/Flutter SDK for the Feeef API: HTTP client, repositories (stores, products, orders, landing pages, etc.), file and AI actions, and third-party integrations (Yalidine, Ecotrack, Google Sheets, and more).
- API client – Single
Feeefentrypoint withinit(baseUrl:); repositories for stores, products, orders, product landing pages, templates, shipping, feedback, users, and config. - Developer apps – OAuth app models include optional
logoUrlfor branded consent/admin UIs. - Attachments – Typed
Attachmentmodel (image, store, product, url, audio) for AI features (image generation, voice, landing page generation). - List responses –
ListResponse<T>with optional meta (total, page, limit) and helpers (hasMore,nextPage). - Errors –
NetworkException,FeeefValidationExceptionwithFeeefViolationand field helpers (getField,getFieldMessage,messages). - Realtime – Optional Transmit-based realtime (CRUD events).
- Integrations – Delivery (Yalidine, Ecotrack, Noest, Procolis), Google Sheets, and others.
- File & AI actions – Storage upload, AI code/component generation, product landing page and voice generation (with typed attachments).
Add to your pubspec.yaml:
dependencies:
feeef: ^1.0.0Then run flutter pub get (or dart pub get).
Before calling any API, set the base URL (and optionally a config for realtime/debug):
import 'package:feeef/feeef.dart';
await Feeef.instance.init(
baseUrl: 'https://api.feeef.org', // or your API host
config: MyFeeefConfig(), // optional: baseUrl, isProduction, debugMode
);
// Use repositories
final stores = Feeef.instance.stores;
final products = Feeef.instance.products;
final orders = Feeef.instance.orders;Use typed attachments when calling image generation, voice, or landing page APIs:
import 'package:feeef/feeef.dart';
final refs = [
ImageAttachment(url: 'https://example.com/ref.png', label: 'Style ref'),
StoreAttachment(value: storeId, label: 'Store'),
];
// Pass refs to e.g. generateProductLandingPageTemplateData, generateVoiceover, etc.See example/feeef_example.dart for more snippets (attachments, ListResponse, validation errors).
Run the example from the package root:
dart run example/feeef_example.dartThe example demonstrates attachments, ListResponse parsing, and error types. Your app should call Feeef.instance.init(baseUrl: ...) with your API URL; the default client base URL is for local development only.
Run tests and collect coverage:
flutter test --coverageThe project enforces at least 90% line coverage on unit-tested SDK code (core, attachments, helpers). After flutter test --coverage, run:
./tool/check_coverage.shThis fails if coverage drops below 90% for that set.
- License – MIT; see LICENSE.
- Publishing – See PUBLISH_READINESS.md for security notes and a publish checklist.
- Changelog – See CHANGELOG.md.