Skip to content

@GenerateMocks does not work on Generic method return types #338

@MaxAuer

Description

@MaxAuer

Hey,

I tried to create a Mock for the following Function:

T add<T extends Base>(T data);

Several Classes are extending Base.

flutter pub run build_runner build throws the following error The method 'Api.add' features a non-nullable unknown return type, and cannot be stubbed.

I am using Mockito: ^5.0.0-nullsafety.7

Any way to get around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions