I have a mixin (MyMixin
) that I apply in the state of some widgets like this:
class MyStfulWidget extends StatefulWidget {
@override
_MyStfulWidget State createState() => _MyStfulWidget State();
}
class _MyStfulWidget State extends State<MyStfulWidget> with MyMixin { ... }
I sometimes need to pass this stateful widgets as a parameter for a method (MyMethod
)
void myMethod(Widget myWidget) { ... }
The problem with the following method is that it accepts every kind of widgets. If I pass a widget that does not have a MyMixin it will not work properly...
Is there any way to force the "myWidget" parameter to be a stateful widget that contains a mixin in its state?
Thanks for the help!