Reputation: 13131
How to get print
console log and screen capture so that I can send stack trace to server?
Upvotes: 2
Views: 3798
Reputation: 101
you can use f_logs package, this has a functionality on export logs to a directory on the phone, it has .db and .txt for the logs, and then you can use flutter_archive package to zip the file, and then use flutter_email_sender to send the zip file that contains the logs your development team. It worked for us, hope this will helps.
Upvotes: 0
Reputation: 116708
You can get a screenshot of the FlutterView using native code.
Bitmap screenshot = flutterView.getBitmap();
See the platform channels documentation on mixing Dart and native code.
As for the stack trace, here are some tips from the Flutter Sentry library documentation.
To get a stack trace from within Flutter, override the onError
handler:
FlutterError.onError = (FlutterErrorDetails details) async {
throw details;
};
To create a Zone with an error handler that catches all Dart exceptions, wrap your call to runApp
in runZoned:
runZoned<Future<Null>>(() async {
runApp(new MyApp());
}, onError: (error, stackTrace) async {
if (error is FlutterErrorDetails) {
// use error.exception and error.stack
} else {
// use error and stackTrace
}
});
Upvotes: 5