argus 0.1.0-dev.1
argus: ^0.1.0-dev.1 copied to clipboard
Flutter-first crash and error reporting: Dart errors, native Android/iOS crashes, device context and a breadcrumb timeline, queued encrypted on-device while offline.
import 'package:argus/argus.dart';
import 'package:flutter/material.dart';
/// Test harness for the SDK. Phase 1 adds the "throw an error" buttons that
/// drive the offline queue end to end; for now it only proves the plugin loads
/// and the method channel answers.
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatefulWidget {
const ExampleApp({super.key});
@override
State<ExampleApp> createState() => _ExampleAppState();
}
class _ExampleAppState extends State<ExampleApp> {
String _status = 'not started';
Future<void> _install() async {
await ArgusPlatform.instance.installNativeHandlers();
final pending = await ArgusPlatform.instance.drainPendingNativeCrashes();
if (!mounted) return;
setState(() => _status = 'handlers installed, ${pending.length} pending');
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Argus example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(_status),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _install,
child: const Text('Install native handlers'),
),
],
),
),
),
);
}
}