easyslo 0.2.1
easyslo: ^0.2.1 copied to clipboard
Track success rates in Flutter apps with offline queueing and automatic retries.
EasySLO Flutter SDK #
Track the success rate of checkout, sign-in, and other user journeys on Android and iOS. EasySLO queues outcomes offline and retries delivery automatically.
Quick start #
flutter pub add easyslo
Get an SDK key from the dashboard’s SDK keys page. Start EasySLO on the main isolate and let local setup run while your app starts. EasySLO dashboard
import 'dart:async';
import 'package:easyslo/easyslo.dart';
import 'package:flutter/widgets.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
unawaited(EasySlo.init('YOUR_SDK_KEY'));
runApp(const MyApp());
}
Outcomes reported before the SDK is ready are skipped and counted in EasySlo.callsBeforeInitialization. Setup errors appear in EasySlo.diagnostics.
Report outcomes #
Record one outcome when each operation finishes. The first upload for a new event key creates a monitor with a 95% target you can change in the dashboard.
try {
await completeCheckout();
unawaited(EasySlo.success('checkout'));
} catch (error) {
unawaited(EasySlo.failure('checkout', error));
rethrow;
}
Use stable event keys matching [A-Za-z0-9_.:-]{1,128}. Keep customer data and secrets out of event keys. Pass the original error so the SDK can classify network, timeout, HTTP 4xx, HTTP 5xx, and other failures. For clients that return failed HTTP responses, pass the response itself or supply a known statusCode. Skip intentional cancellations. The SDK records the failure category and object type. Exception messages, stack traces, and request or response data stay out of telemetry.
Customer identity #
The SDK generates and persists a random customer ID. Pass an opaque account ID as customerId during initialization or call EasySlo.setCustomerId(id) once the SDK is ready. Call EasySlo.setCustomerId(null) on logout to restore the generated ID. Supply custom IDs again on each launch.
Delivery behavior #
The local SQLite queue survives restarts. Events expire after seven days. The queue holds up to 10,000 events or 10 MiB. Use EasySlo.diagnostics to inspect delivery and EasySlo.flush() to request a delivery attempt. Flush respects retry backoff.
Key rotation #
Use the same stable queueNamespace from the first release to retain queued events when rotating keys for the same project. Use a separate namespace for each project and environment.
SDK development and self-hosting #
Set the service origin at build time with --dart-define=MOBILESLO_INGEST_ORIGIN=https://your-service.example. Use a key from that service. Local HTTP is supported on localhost, 127.0.0.1, and 10.0.2.2.
For API details or migration from Sdk in 0.1.x, see the API reference and changelog.