ErrorService class

异常聚合服务 / Error aggregation service

接管 FlutterError.onError(保留默认红色报错行为),把每次异常按 类型 + 堆栈签名去重聚合,记录出现次数、首末次时间与一条完整堆栈样本, 形成独立的 Errors Tab,供开发者快速定位"同一处崩溃反复出现"的问题。 Hooks FlutterError.onError (keeping the default red error behavior), dedups each exception by type + stack signature, and records count, first/last seen time and a full stack sample — powering a dedicated Errors Tab to surface "the same crash happening repeatedly".

同时接管 PlatformDispatcher.onError:它能捕获 FlutterError.onError 漏掉的、发生在框架错误边界之外或平台通道回包中的异常(例如绘制/布局阶段 抛错后再次被框架捕获前的原始错误),避免这类崩溃完全不被聚合。 Also hooks PlatformDispatcher.onError, which catches errors that FlutterError.onError misses — those thrown outside the framework error boundary or from platform-channel replies — so they are aggregated too.

Inheritance

Properties

errorCount → int
聚合记录数量 / Aggregated record count
no setter
errors → UnmodifiableListView<ErrorRecord>
聚合记录只读视图 / Read-only aggregated records view
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isEnabled ↔ bool
获取是否启用 / Get whether enabled
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() → void
清空所有聚合记录 / Clear all aggregated records
dispose() → void
Discards any resources used by the object.
inherited
install() → void
接管 FlutterError.onError 与 PlatformDispatcher.onError(均保留默认行为) Hook both FlutterError.onError and PlatformDispatcher.onError (default behavior preserved for both).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
report(Object exception, StackTrace? stack, [String context = '']) → void
手动上报一个异常(gRPC/自定义协议或 Zone 捕获)/ Manual report
restore(Iterable<ErrorRecord> records) → void
恢复持久化的聚合异常(跨重启不丢)。 Restore persisted aggregated errors (survives restarts).
toString() → String
A string representation of this object.
inherited
uninstall() → void
还原 FlutterError.onError 与 PlatformDispatcher.onError Restore both FlutterError.onError and PlatformDispatcher.onError

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → ErrorService
单例实例 / Singleton instance
final