baseerh_sdk 0.1.1
baseerh_sdk: ^0.1.1 copied to clipboard
Baseera analytics & engagement SDK for Flutter — product analytics, feature flags, push, and PDPL-compliant consent for iOS & Android.
example/lib/main.dart
import 'package:baseerh_sdk/baseerh_sdk.dart';
import 'package:flutter/material.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Baseerh.instance.setup(
const BaseerhConfig(
apiKey: 'pk_test_replace_me',
// host: 'https://api.baseerh.com', // default
debug: true,
),
);
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Baseerh SDK Example',
theme: ThemeData(colorSchemeSeed: Colors.teal, useMaterial3: true),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
final sdk = Baseerh.instance;
return Scaffold(
appBar: AppBar(title: const Text('Baseerh SDK')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FilledButton(
onPressed: () =>
sdk.capture('button_clicked', properties: {'screen': 'home'}),
child: const Text('Capture event'),
),
const SizedBox(height: 12),
FilledButton(
onPressed: () =>
sdk.identify('user-42', properties: {'plan': 'pro'}),
child: const Text('Identify user'),
),
const SizedBox(height: 12),
FilledButton(
onPressed: () => sdk.trackRevenue(99, 'SAR'),
child: const Text('Track revenue'),
),
const SizedBox(height: 12),
OutlinedButton(
onPressed: () => sdk.flush(),
child: const Text('Flush now'),
),
const SizedBox(height: 12),
Builder(builder: (context) {
final enabled = sdk.isFeatureEnabled('new_checkout');
return Text('new_checkout flag: $enabled');
}),
],
),
),
);
}
}