myappcrew_flutter 0.1.1
myappcrew_flutter: ^0.1.1 copied to clipboard
MyAppCrew Flutter SDK for bootstrapping testers, tracking screens, and batching events.
MyAppCrew Flutter SDK #
A tiny Flutter SDK to bootstrap tester sessions, queue events, auto-track screens, and flush batches safely.
Install (pub.flutter-io.cn) #
flutter pub add myappcrew_flutter
Install (path dependency) #
Option A: path dependency
dependencies:
myappcrew_flutter:
path: ../myappcrew_flutter_sdk/packages/myappcrew_flutter
Minimal usage #
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final result = await MyAppCrew.initialize(
publicKey: 'YOUR_PUBLIC_KEY',
baseUrl: 'https://api.myappcrew.com',
);
runApp(
MaterialApp(
navigatorObservers: [
MyAppCrew.navigatorObserver(),
],
home: const MyHomePage(),
),
);
if (result.ok) {
MyAppCrew.logEvent('button_click', properties: {
'label': 'Subscribe',
});
await MyAppCrew.flushNow();
}
}
Configuration via --dart-define #
flutter run -d <device> \
--dart-define=MYAPPCREW_BASE_URL=https://myappcrew-tw.pages.dev \
--dart-define=MYAPPCREW_PUBLIC_KEY=com.test_app.test
Data sent #
namets(seconds)screensessionIdproperties
Notes #
baseUrlis required and must not assume localhost.ingestUrlcomes from the bootstrap response and may change server-side.- All event timestamps use UNIX seconds (10-digit).
- Retries use small backoff; no infinite loops.
- SDK is best-effort and should not crash the host app.
Example app #
An example app is available under example/.
cd example
flutter pub get
flutter run -d <device> \
--dart-define=MYAPPCREW_BASE_URL=https://myappcrew-tw.pages.dev \
--dart-define=MYAPPCREW_PUBLIC_KEY=com.test_app.test