flutter_log_handler 0.0.1
flutter_log_handler: ^0.0.1 copied to clipboard
A powerful logging handler with UI, crash capture, interceptor logging and file sharing.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_log_handler/flutter_log_handler.dart';
void main() {
LogService.init(
const LogConfig(
maxLogs: 200,
retentionDays: 3,
fileName: "example_logs.txt",
),
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(home: HomeScreen());
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Log Example")),
body: Center(
child: ElevatedButton(
onPressed: () {
LogService.to.logEvent(
message: "Button clicked",
level: LogLevel.info,
);
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const LogScreen()),
);
},
child: const Text("Generate Log & Open Logs"),
),
),
);
}
}