File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -512,9 +512,9 @@ class _MockTargetGatherer {
512
512
513
513
static Iterable <_MockTarget > _mockTargetsFromGenerateMocks (
514
514
ElementAnnotation annotation, LibraryElement entryLib) {
515
- final generateMocksValue = annotation.computeConstantValue ()! ;
516
- final classesField = generateMocksValue.getField ('classes' )! ;
517
- if (classesField.isNull) {
515
+ final generateMocksValue = annotation.computeConstantValue ();
516
+ final classesField = generateMocksValue? .getField ('classes' );
517
+ if (classesField == null || classesField .isNull) {
518
518
throw InvalidMockitoAnnotationException (
519
519
'The GenerateMocks "classes" argument is missing, includes an '
520
520
'unknown type, or includes an extension' );
@@ -548,7 +548,7 @@ class _MockTargetGatherer {
548
548
fallbackGenerators: {},
549
549
));
550
550
}
551
- final customMocksField = generateMocksValue.getField ('customMocks' );
551
+ final customMocksField = generateMocksValue? .getField ('customMocks' );
552
552
if (customMocksField != null && ! customMocksField.isNull) {
553
553
final customMocksAsts =
554
554
_customMocksAst (annotation.annotationAst)? .elements ??
Original file line number Diff line number Diff line change @@ -30,11 +30,11 @@ class GenerateMocks {
30
30
final List<Type> classes;
31
31
final List<MockSpec> customMocks;
32
32
33
- const GenerateMocks(this.classes, {this.customMocks = []});
33
+ const GenerateMocks(this.classes, {this.customMocks = const []});
34
34
}
35
35
36
36
class MockSpec<T> {
37
- final Symbol mockName;
37
+ final Symbol? mockName;
38
38
39
39
final bool returnNullOnMissingStub;
40
40
@@ -43,7 +43,7 @@ class MockSpec<T> {
43
43
final Map<Symbol, Function> fallbackGenerators;
44
44
45
45
const MockSpec({
46
- Symbol as,
46
+ Symbol? as,
47
47
this.returnNullOnMissingStub = false,
48
48
this.unsupportedMembers = const {},
49
49
this.fallbackGenerators = const {},
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class GenerateNiceMocks {
39
39
}
40
40
41
41
class MockSpec<T> {
42
- final Symbol mockName;
42
+ final Symbol? mockName;
43
43
44
44
final List<Type> mixins;
45
45
You can’t perform that action at this time.
0 commit comments