How do I correctly Mixin on State?

Posted by Pinki | Updated on

In this example, I will share how you can do correctly Mixin on State. You should define your mixin like this:

This ensures that the generic type of your mixin is the same as the generic type for your State class. If you omit the type for on State, it is going to default to StatefulWidget, but you need to match the exact type, which you can with the syntax I provided.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers