close
Skip to content

Documentation: Throws type 'Null' is not a subtype of type 'SomeType' #78

@morrowyn

Description

@morrowyn

Hi,

I greatly appreciate the work that you are doing for the fluttter community. Especially since the null-safety and creating a better tool than mockito.

I ran into the following issue when porting from mockito to mocktail, whereas mockito somehow skipped non-mocked methods because of being null.

I received this error:

Throws type 'Null' is not a subtype of type 'Future<void>'

Now it took me a while to figure out what was happening, so maybe you could add a small paragraph explaining what to do when hitting this error when porting your mockito code to mocktail.

Eg. something like this:

When you receive the following error:

Throws type 'Null' is not a subtype of type 'SomeType'

This error means you need to add a when(() => mock.missingMockMethod()).thenAnswer((_) => yourAnswer) on that particular method of your mock you are using, since mockito kindly skipped this for you because it was null in the pre-null-safety era.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions