Skip to content

Commit 119f905

Browse files
tijoforyoucopybara-github
authored andcommitted
Bump Dart SDK version to 3.7.0
Reformat all code with the new formatter. PiperOrigin-RevId: 736896150
1 parent 14e96ec commit 119f905

22 files changed

+1483
-1158
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.4.7-wip
2+
3+
* Require Dart SDK ^3.7.0.
4+
15
## 5.4.6
26

37
* When formatting a generated mocks library, use the language version of the

example/example.dart

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ abstract class Callbacks {
3131
String? makeSound();
3232
}
3333

34-
@GenerateMocks([
35-
Cat,
36-
Callbacks,
37-
], customMocks: [
38-
MockSpec<Cat>(
39-
as: #MockCatRelaxed,
40-
onMissingStub: OnMissingStub.returnDefault,
41-
),
42-
])
34+
@GenerateMocks(
35+
[Cat, Callbacks],
36+
customMocks: [
37+
MockSpec<Cat>(
38+
as: #MockCatRelaxed,
39+
onMissingStub: OnMissingStub.returnDefault,
40+
),
41+
],
42+
)
4343
void main() {
4444
late Cat cat;
4545

@@ -103,8 +103,9 @@ void main() {
103103
when(cat.eatFood(argThat(startsWith('dry')))).thenReturn(false);
104104

105105
// ... or mix arguments with matchers
106-
when(cat.eatFood(argThat(startsWith('dry')), hungry: true))
107-
.thenReturn(true);
106+
when(
107+
cat.eatFood(argThat(startsWith('dry')), hungry: true),
108+
).thenReturn(true);
108109
expect(cat.eatFood('fish'), isTrue);
109110
expect(cat.walk(['roof', 'tree']), equals(2));
110111
expect(cat.eatFood('dry food'), isFalse);
@@ -123,18 +124,21 @@ void main() {
123124
verify(cat.hunt('backyard', null)); // OK: no arg matchers.
124125

125126
cat.hunt('backyard', null);
126-
verify(cat.hunt(argThat(contains('yard')),
127-
argThat(isNull))); // OK: null is wrapped in an arg matcher.
127+
verify(
128+
cat.hunt(argThat(contains('yard')), argThat(isNull)),
129+
); // OK: null is wrapped in an arg matcher.
128130
});
129131

130132
test('Named arguments', () {
131133
// GOOD: argument matchers include their names.
132134
when(cat.eatFood(any, hungry: anyNamed('hungry'))).thenReturn(true);
133-
when(cat.eatFood(any, hungry: argThat(isNotNull, named: 'hungry')))
134-
.thenReturn(false);
135+
when(
136+
cat.eatFood(any, hungry: argThat(isNotNull, named: 'hungry')),
137+
).thenReturn(false);
135138
when(cat.eatFood(any, hungry: captureAnyNamed('hungry'))).thenReturn(false);
136-
when(cat.eatFood(any, hungry: captureThat(isNotNull, named: 'hungry')))
137-
.thenReturn(true);
139+
when(
140+
cat.eatFood(any, hungry: captureThat(isNotNull, named: 'hungry')),
141+
).thenReturn(true);
138142
});
139143

140144
test('Verifying exact number of invocations / at least x / never', () {
@@ -192,8 +196,9 @@ void main() {
192196
// Conditional capture:
193197
cat.eatFood('Milk');
194198
cat.eatFood('Fish');
195-
expect(
196-
verify(cat.eatFood(captureThat(startsWith('F')))).captured, ['Fish']);
199+
expect(verify(cat.eatFood(captureThat(startsWith('F')))).captured, [
200+
'Fish',
201+
]);
197202
});
198203

199204
test('Waiting for an interaction', () async {

lib/annotations.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@ class MockSpec<T> {
130130
/// as a legal return value.
131131
const MockSpec({
132132
Symbol? as,
133-
@Deprecated('Avoid adding concrete implementation to mock classes. '
134-
'Use a manual implementation of the class without `Mock`')
133+
@Deprecated(
134+
'Avoid adding concrete implementation to mock classes. '
135+
'Use a manual implementation of the class without `Mock`',
136+
)
135137
List<Type> mixingIn = const [],
136138
this.unsupportedMembers = const {},
137139
this.fallbackGenerators = const {},
138140
this.onMissingStub,
139-
}) : mockName = as,
140-
mixins = mixingIn;
141+
}) : mockName = as,
142+
mixins = mixingIn;
141143
}
142144

143145
/// Values indicating the action to perform when a real call is made to a mock
@@ -151,5 +153,5 @@ enum OnMissingStub {
151153
/// For basic known types, like `int` and `Future<String>`, a simple value is
152154
/// returned (like `0` and `Future.value('')`). For unknown user types, an
153155
/// instance of a fake implementation is returned.
154-
returnDefault;
156+
returnDefault,
155157
}

lib/mockito.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export 'src/mock.dart'
2424
Mock,
2525
SmartFake,
2626
named, // ignore: deprecated_member_use_from_same_package
27-
2827
// -- setting behaviour
2928
when,
3029
any,
@@ -36,7 +35,6 @@ export 'src/mock.dart'
3635
Answering,
3736
Expectation,
3837
PostExpectation,
39-
4038
// -- verification
4139
verify,
4240
verifyInOrder,
@@ -46,7 +44,6 @@ export 'src/mock.dart'
4644
VerificationResult,
4745
Verification,
4846
ListOfVerificationResult,
49-
5047
// -- misc
5148
throwOnMissingStub,
5249
clearInteractions,

0 commit comments

Comments
 (0)