myappcrew_flutter 0.1.6
myappcrew_flutter: ^0.1.6 copied to clipboard
MyAppCrew Flutter SDK for bootstrapping testers, tracking screens, and batching events.
MyAppCrew Flutter SDK #
Headless SDK for bootstrapping testers, tracking lifecycle/screen events, and batching events.
Minimal install (dependency + init) #
- Add dependency:
flutter pub add myappcrew_flutter
- Initialize once in
main.dart:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await MyAppCrewFlutter.init(publicKey: 'YOUR_PUBLIC_KEY');
runApp(const MyApp());
}
Notes:
baseUrlis optional and defaults tohttps://myappcrew-tw.pages.dev.- If
publicKeyis missing, the SDK disables itself (no network calls).
Optional: screen tracking (navigator observer) #
Add the navigator observer when you want screen tracking:
final observer = MyAppCrewFlutter.navigatorObserver();
MaterialApp(
navigatorObservers: observer == null ? const [] : [observer],
home: const MyHomePage(),
);
Optional: manual connect (claim link, token, or 6-digit code) #
- Tester joins the invite in a browser.
- Copy the claim token, full claim link, or 6-digit Connect Code.
- In-app, call
connectFromText(...)(token, URL, or 6-digit code):
ElevatedButton(
onPressed: () async {
final result = await MyAppCrewFlutter.connectFromText(inputText);
if (result.connected) {
// Connected
}
},
child: const Text('Connect tester'),
);
Optional: connect prompt UI (debug-only by default) #
Auto-prompt testers for the 6-digit Connect Code without extra app state.
Option A (recommended):
runApp(MyAppCrewConnectWrapper(
child: const MyApp(),
));
Option B (MaterialApp builder):
MaterialApp(
builder: (context, child) => MyAppCrewConnectWrapper(child: child!),
)
Notes:
- Debug builds only by default. Enable in release with
MyAppCrewConnectWrapper(enabled: true, ...). - Testers enter the 6-digit Connect Code from the invite page.
- Once connected, they will not be prompted again unless the app is cleared or reinstalled (or the public key changes).
Debugging (safe snapshot + logging) #
Read a safe snapshot that excludes secrets:
final snapshot = MyAppCrewFlutter.getDebugSnapshot();
Enable SDK logging explicitly (off by default):
MyAppCrewFlutter.setDebugLogging(true);
You can also enable logging at compile time:
flutter run --dart-define=MYAPPCREW_DEBUG_LOGS=true