easyslo 0.1.1
easyslo: ^0.1.1 copied to clipboard
Lightweight outcome monitoring for Flutter. Persistent batching, offline retries, and success-rate SLOs.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:easyslo/easyslo.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Await local setup so the first app outcomes can be persisted. Network
// delivery runs in the background and initialization errors never escape.
await Sdk.init(const String.fromEnvironment('MOBILESLO_KEY'));
runApp(const Example());
}
class Example extends StatelessWidget {
const Example({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('EasySLO example')),
body: Center(
child: Column(mainAxisSize: MainAxisSize.min, children: [
FilledButton(
onPressed: () => Sdk.success('checkout'),
child: const Text('Report successful checkout')),
OutlinedButton(
onPressed: () =>
Sdk.failure('checkout', Exception('Checkout failed')),
child: const Text('Report failed checkout')),
TextButton(
onPressed: () => Sdk.flush(),
child: const Text('Flush queued outcomes')),
]))));
}