stack_trace
stack_trace copied to clipboard
Remove unused Chain.disable functionality
I cannot find any uses of the Chain.disable
API outside of the tests in this package. It is unnecessary complexity. Removing the functionality may also remove some of the overhead from this package since we can omit a boolean check and reading a zone variable for every zone callback.
Any concerns @jakemac53 @lrhn ?
Hmm, we might not be able to do a major version release because of flutter pinning. 😢
No real opinion on removing the behavior. Sure, go for it!
The implementation looks potentially unsafe. If you disable stack chaining using this function, then start a new stack chaining inside it, then the value won't be correct. (It will enable the outer stack chaining zone as well).
The test, if anything, should be if (!identical(this, zone[Chain._specKey])) return parent.registerCallback(zone, f);
,
and then you don't need the extra boolean zone-variable.
(Don't read Zone.current
in a zone callback, always use the zone
parameter. A subzone might have chosen to change that argument deliberately.)
If there is no known usage, I would be ok with removing this as a minor version bump. It will likely cause less pain than revving the whole ecosystem.