Appearance
Flutter
Install
sh
flutter pub add simpledatalogs_flutterUntil the package is on pub.dev, add it from GitHub as shown in the Flutter SDK page.
Add it
dart
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:simpledatalogs_flutter/simpledatalogs_flutter.dart';
Future<void> main() async {
await SimpleDataLogsFlutter.configure(
ingestKey: const String.fromEnvironment('SIMPLEDATALOGS_KEY'),
autocapture: AutocaptureOptions.all,
);
runApp(MaterialApp(
navigatorObservers: [SimpleDataLogsNavigatorObserver()],
home: const HomePage(),
));
}dart
// Anywhere:
SimpleDataLogs.track('signup', {'plan': 'pro'});Run with flutter run --dart-define=SIMPLEDATALOGS_KEY=sdl_pub_…. Events wait in a crash-safe outbox until a 202, so nothing is lost if the app is killed.
Send everything, or only what you choose
- Everything:
AutocaptureOptions.allsends launches, sessions and uncaught errors. - Pick:
AutocaptureOptions(sessions: true, errors: true). - Only your own events: leave
autocaptureout.
In the first minute
session_startandapp_launchedwithin 10 seconds (5 in debug builds), or as soon as the app is hidden.- A
screen_viewfor every named route you open. - With
SimpleDataLogs.setDeviceId(anonymousId)beforeconfigure, the device counts in active devices.
Autocapture defaults
| Option | With AutocaptureOptions.all |
|---|---|
appLaunches | on |
sessions (30 minutes away ends one) | on |
errors (uncaught Flutter and platform errors, as app_error) | on |
| Screen views | named page routes, with SimpleDataLogsNavigatorObserver |
Dart servers use the pure Dart package. Everything else is in the Flutter SDK reference.