testernest_flutter 0.1.1
testernest_flutter: ^0.1.1 copied to clipboard
TesterNest Flutter SDK for bootstrapping testers, tracking screens, and batching events.
TesterNest Flutter SDK #
Headless SDK for bootstrapping testers, tracking lifecycle/screen events, and batching events.
Minimal install (dependency + init) #
- Add dependency:
flutter pub add testernest_flutter
Import:
import 'package:testernest_flutter/testernest_flutter.dart';
- Initialize once in
main.dart:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await TesterNestFlutter.init(publicKey: 'YOUR_PUBLIC_KEY');
runApp(const MyApp());
}
Notes:
baseUrlis optional and defaults tohttps://testernest.com.- 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 = TesterNestFlutter.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 TesterNestFlutter.connectFromText(inputText);
if (result.connected) {
// Connected
}
},
child: const Text('Connect tester'),
);
Tester identity persistence #
After a successful connect, the SDK stores the tester identity and reuses it on app relaunches for the same public key. Connected identities persist across restarts; only uninstalling the app or clearing storage resets them. If the backend invalidates a token temporarily, the SDK retries silently and keeps events queued without prompting. Only explicit revocations clear the identity and require a reconnect prompt.
TesterNestFlutter.setOnTesterIdentityInvalid((reason) {
// Show reconnect UI when a stored identity becomes invalid.
});
final connected = TesterNestFlutter.isTesterConnected();
final tester = TesterNestFlutter.getConnectedTester();
await TesterNestFlutter.disconnectTester();
Optional: connect prompt UI (debug-only by default) #
Auto-prompt testers for the 6-digit Connect Code without extra app state.
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await TesterNestFlutter.init(publicKey: 'YOUR_PUBLIC_KEY');
runApp(const TesterNestConnectPrompt(child: MyApp()));
}
Notes:
- Debug builds only by default. Enable in release with
TesterNestConnectPrompt(debugOnly: false, ...). - Testers enter the 6-digit Connect Code from the invite page.
Debugging (safe snapshot + logging) #
Read a safe snapshot that excludes secrets:
final snapshot = TesterNestFlutter.getDebugSnapshot();
Enable SDK logging explicitly (off by default):
TesterNestFlutter.setDebugLogging(true);