verifyTickersWereDisposed method
Throws an exception if any tickers created by the WidgetTester are still active when the method is called.
An argument can be specified to provide a string that will be used in the error message. It should be an adverbial phrase describing the current situation, such as "at the end of the test".
Implementation
void verifyTickersWereDisposed([ String when = 'when none should have been' ]) {
assert(when != null);
if (_tickers != null) {
for (Ticker ticker in _tickers) {
if (ticker.isActive) {
throw FlutterError(
'A Ticker was active $when.\n'
'All Tickers must be disposed. Tickers used by AnimationControllers '
'should be disposed by calling dispose() on the AnimationController itself. '
'Otherwise, the ticker will leak.\n'
'The offending ticker was: ${ticker.toString(debugIncludeStack: true)}'
);
}
}
}
}