Recently we’ve been exploring the ability to extend the base State<T>
class, to add additional capabilities to our views, or writing our own custom Mixins to do the same.
Most Developers are familiar with using the various framework Mixins, like TickerProviderStateMixin
but what is not commonly known, is how easy it is to create your own flavors of these. Additionally, many developers extend State<T>
constantly, and write very repetitive boilerplate code, without realizing how easy it is to create their own BaseState<T>
instead.
In this example, we’ll make a “base state” that provides 3 AnimatorControllers to any widget that needs to animate something. We could then apply this to any Widget in our application, and it automatically get 3 animators to play with. No setup, or teardown required.
Continue reading →