dispose method
Disposes the mock and clears all state history.
After disposal, all methods will throw a StateError if called. This ensures proper cleanup and prevents memory leaks in tests.
Implementation
@override
void dispose() {
if (!_disposed) {
_stateHistory.clear();
_disposed = true;
super.dispose();
}
}