如何从哨兵Flutter获取有用的堆栈跟踪

问题描述

我已将哨兵添加到我的Flutter应用程序中。在产品应用中,我遇到了一些异常。但是哨兵没有捕获引起问题的电话号码和代码

示例

PlatformAssetBundle.load中的FlutterError asset_bundle.dart FlutterError:无法加载资产:文件“ asset_bundle.dart”,行 223,在PlatformAssetBundle.load文件中,“”
AssetBundle.loadString文件中的文件“ asset_bundle.dart”,第69行 “”文件“ picture_provider.dart”,第449行, AssetBundlePictureProvider._loadAsync中的文件“”文件“未分析的”文件“”
文件“未解析”

哨兵整合

    Future<Null> main() async {
      FlutterError.onError = (FlutterErrorDetails details) async {
        if (isInDebugMode) {
          // In development mode simply print to console.
          FlutterError.dumpErrorToConsole(details);
        } else {
          // In production mode report to the application zone to report to
          // Sentry.
          Zone.current.handleUncaughtError(details.exception,details.stack);
        }
      };
    
      runZonedGuarded<Future<Null>>(() async {
        runApp(new Application());
      },(error,stackTrace) async {
        await _reportError(error,stackTrace);
      });
    }
    
    
    Future<Null> _reportError(dynamic error,dynamic stackTrace) async {

    final AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
       var event= Event(
          release: Constants.APP_VERSION,environment: 'production',userContext: User(id: Constants.customerMobile),extra: <String,dynamic>{
            'type': androidDeviceInfo.type,'model': androidDeviceInfo.model,'device': androidDeviceInfo.device,'id': androidDeviceInfo.id,'androidId': androidDeviceInfo.androidId,'brand': androidDeviceInfo.brand,'display': androidDeviceInfo.display,'hardware': androidDeviceInfo.hardware,'manufacturer': androidDeviceInfo.manufacturer,'product': androidDeviceInfo.product,'version': androidDeviceInfo.version.release,'supported32BitAbis': androidDeviceInfo.supported32BitAbis,'supported64BitAbis': androidDeviceInfo.supported64BitAbis,'supportedAbis': androidDeviceInfo.supportedAbis,'isPhysicalDevice': androidDeviceInfo.isPhysicalDevice,},exception: exception,stackTrace: stackTrace,culprit: exception is dioError ? exception.request.path : "",);
    
      await _sentry.capture(event: event);
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)