Automated g4 rollback of changelist 427490997.
*** Reason for rollback ***
Breaking existing code, due to https://github.com/dart-lang/sdk/issues/47473.
*** Original change description ***
Mark a few functions as `@useResult` to prevent accidental misuse.
***
PiperOrigin-RevId: 427568105
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e0514a..5537119 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,8 +14,6 @@
* Support generating a mock class for a class with members with non-nullable
unknown return types via a new parameter on `MockSpec` called
`unsupportedMembers`. See [NULL_SAFETY_README][] for details.
-* Mark `when`, `verify`, `verifyInOrder`, `verifyNever`, and `untilCalled` with
- `@useResult` to encourage proper API use.
## 5.0.17
diff --git a/lib/src/mock.dart b/lib/src/mock.dart
index da82367..c6ccf2f 100644
--- a/lib/src/mock.dart
+++ b/lib/src/mock.dart
@@ -892,7 +892,6 @@
///
/// Mockito will pass the current test case, as `cat.eatFood` has not been
/// called with `"chicken"`.
-@useResult
Verification get verifyNever => _makeVerify(true);
/// Verify that a method on a mock object was called with the given arguments.
@@ -922,7 +921,6 @@
///
/// See also: [verifyNever], [verifyInOrder], [verifyZeroInteractions], and
/// [verifyNoMoreInteractions].
-@useResult
Verification get verify => _makeVerify(false);
Verification _makeVerify(bool never) {
@@ -990,7 +988,6 @@
/// given, but not that those were the only calls. In the example above, if
/// other calls were made to `eatFood` or `sound` between the three given
/// calls, or before or after them, the verification will still succeed.
-@useResult
_InOrderVerification get verifyInOrder {
if (_verifyCalls.isNotEmpty) {
throw StateError(_verifyCalls.join());
@@ -1083,7 +1080,6 @@
/// The response generators include `thenReturn`, `thenAnswer`, and `thenThrow`.
///
/// See the README for more information.
-@useResult
Expectation get when {
if (_whenCall != null) {
throw StateError('Cannot call `when` within a stub response');
@@ -1110,7 +1106,6 @@
/// In the above example, the untilCalled(cat.chew()) will complete only when
/// that method is called. If the given invocation has already been called, the
/// future will return immediately.
-@useResult
InvocationLoader get untilCalled {
_untilCalledInProgress = true;
return <T>(T _) {