Dart Zone-based error propagation in AOT deployments
0 reputation · 05 Apr 2020, 11:09 UTC
In production-level Dart applications, capturing unhandled exceptions within asynchronous boundaries often fails when using standard global try-catch blocks. While the logging package provides structured output listeners, errors within Future objects that are not explicitly awaited can result in silent process termination without distinct log entries.
The primary challenge lies in ensuring that Zone.runGuError correctly intercepts errors that escape the main event loop stack. Furthermore, when deploying via AOT compilation with the --obfuscate flag, the resulting stack traces often lack clarity, making it difficult to correlate the captured error with the original source code logic.
Does a custom ZoneSpecification reliably guarantee the capture of errors from unawaited Futures in a minified AOT environment? What are the specific requirements for ensuring stack traces captured via these zones remain compatible with de-obfuscation tools using generated symbol files?