0
如何獲得print
控制檯日誌和屏幕截圖,以便我可以發送堆棧跟蹤到服務器?如何從撲翼應用程序發送打印日誌?
如何獲得print
控制檯日誌和屏幕截圖,以便我可以發送堆棧跟蹤到服務器?如何從撲翼應用程序發送打印日誌?
您可以使用本機代碼獲取FlutterView的屏幕截圖。
Bitmap screenshot = flutterView.getBitmap();
查看關於混合Dart和本機代碼的文檔platform channels。
至於堆棧跟蹤,這裏有一些來自Flutter Sentry library文檔的提示。
從內部撲獲得堆棧跟蹤,覆蓋onError
處理程序:
FlutterError.onError = (FlutterErrorDetails details) async {
throw details;
};
要創建區與捕獲所有飛鏢異常錯誤處理程序,換你來runApp
呼叫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
}
});
[Crashy](https://github.com/flutter/crashy/blob/master/lib/main.dart)也有很好的例子。 –