kitty_sdk 0.8.0
kitty_sdk: ^0.8.0 copied to clipboard
Kitty Flutter SDK — unified package for device fingerprint attribution (Flare) and authentication, user management, licenses & subscriptions (Account) against the Kitty Launch platform APIs.
Kitty Flutter SDK #
Unified Flutter SDK for the Kitty Launch platform — combines Flare (device fingerprint attribution) and Account (authentication, user management, licenses, subscriptions) in a single package.
Install #
dependencies:
kitty_sdk: ^0.6.0
Quick Start #
import 'package:kitty_sdk/kitty_sdk.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await KittySdk.initialize(
config: KittySdkConfig(
projectId: 'proj_xxx',
accountBaseUrl: '<your-account-api-url>',
flareBaseUrl: '<your-flare-api-url>',
),
);
runApp(const MyApp());
}
Usage #
Flare — fingerprint identification #
final match = await KittySdk.flare.identify();
if (match != null) {
print('Matched! uid=${match.uid} type=${match.matchType}');
}
Account — authentication #
final account = await KittySdk.account.loginWithPassword(
email: 'user@example.com',
password: 'secret',
);
KittySdk.account.accountStream.listen((account) {
// React to auth state changes
});
Account — licenses #
final user = KittySdk.account.currentAccount;
final license = user?.bestLicense;
if (license != null && license.isActive) {
// User has active license
}
Buy Now — web paywall with mobile prices #
Requires Common Module v13.4.0+ on the web side.
final products = <ProductDetails>{...}; // from InAppPurchase
router.push(MaterialPageRoute(
builder: (_) => KittyWebBuyNowPage(
url: 'https://your-domain.com/buy-now', // Kitty Flow url
products: products,
onPaymentSuccess: () {
router.pop();
},
),
));
Modules #
| Module | Access | Description |
|---|---|---|
| Flare | KittySdk.flare |
Device fingerprint identification & purchase attribution |
| Account | KittySdk.account |
Auth, user management, licenses, subscriptions |
| Tokens | KittySdk.tokens |
Token balance and operations (requires Account) |
| Buy Now | KittySdk.buyNow |
Web paywall with mobile price bridging |
Tokens — balance and operations #
// 1. Enable tokens in KittySdkConfig
await KittySdk.initialize(
config: KittySdkConfig(
projectId: 'proj_xxx',
accountBaseUrl: '...',
flareBaseUrl: '...',
tokens: const KittyTokensConfig(isDebug: true),
),
);
// 2. Use the module (user must be logged in via KittySdk.account)
final balance = await KittySdk.tokens.getBalance();
print('Tokens: ${balance.balance}');
// Add tokens
await KittySdk.tokens.addTokens(10, description: 'purchase');
// Remove tokens
await KittySdk.tokens.removeTokens(5, description: 'generation');
// Get operations history
final ops = await KittySdk.tokens.getOperations(skip: 0, limit: 20);
// 3. Use the Cubit in your UI
BlocProvider(
create: (_) => TokensCubit(tokens: KittySdk.tokens)..loadBalance(),
child: BlocBuilder<TokensCubit, TokensState>(
builder: (context, state) {
if (state.isLoading) return const CircularProgressIndicator();
return Text('Balance: ${state.tokenCount}');
},
),
)