-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.mockor.dart
50 lines (45 loc) · 1.44 KB
/
example.mockor.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: non_constant_identifier_names
part of 'example.dart';
// **************************************************************************
// MockerGenerator
// **************************************************************************
@GenerateNiceMocks([
MockSpec<ExampleUseCase>(
as: #MockExampleUseCase,
),
MockSpec<ExampleUseCase2>(
as: #MockExampleUseCase2,
),
])
dynamic _$mock<T extends Object>({bool? relaxed}) {
relaxed ??= false;
switch (T) {
case ExampleUseCase:
case MockExampleUseCase:
final mock = MockExampleUseCase();
if (!relaxed) {
throwOnMissingStub(mock);
}
return mock;
case ExampleUseCase2:
case MockExampleUseCase2:
final mock = MockExampleUseCase2();
if (!relaxed) {
throwOnMissingStub(mock);
}
return mock;
default:
throw UnimplementedError(
'''Error, a mock class for '$T' has not been generated yet.
Navigate to the 'mock' method and add the type to the types list in the 'GenerateMocker' annotation.
Finally run the build command: 'flutter packages pub run build_runner build'.''');
}
}
extension ExampleUseCaseAsMockExtension on ExampleUseCase {
MockExampleUseCase asMock() => this as MockExampleUseCase;
}
extension ExampleUseCase2AsMockExtension on ExampleUseCase2 {
MockExampleUseCase2 asMock() => this as MockExampleUseCase2;
}