runGuarded<T> static method
void
runGuarded<T>(
- ValueGetter<
T> body, { - FlutterExceptionHandler? onException,
- String? filterPattern,
- bool reportInDebugMode = false,
异常上报。该方法等同于 runZonedGuarded。
body 运行的内容。
onException 自定义异常处理,可用于异常打印、双上报等定制逻辑。该字段不影响上报。
filterPattern 针对 message 正则过滤异常上报,命中则不上报。
reportInDebugMode 是否在调试模式也上报。
全局异常捕获回调(FlutterError.onError 与 PlatformDispatcher.onError) 仅在首次调用时安装,重复调用不会重复注册;安装前已存在的回调会被链式保留。
Implementation
static void runGuarded<T>(
ValueGetter<T> body, {
FlutterExceptionHandler? onException,
String? filterPattern,
bool reportInDebugMode = false,
}) => FlutterTencentBuglyPlatform.instance.runGuarded(
body,
onException: onException,
filterPattern: filterPattern,
reportInDebugMode: reportInDebugMode,
);