2017-09-03 57 views

回答

2

您可以使用本機代碼獲取FlutterView的屏幕截圖。

  • 在Android上:Bitmap screenshot = flutterView.getBitmap();
  • 在iOS上,看到這個example從蘋果。

查看關於混合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 
    } 
}); 
+0

[Crashy](https://github.com/flutter/crashy/blob/master/lib/main.dart)也有很好的例子。 –

相關問題