Introducing functional_widget, a code generator that generates Widget classes from a function.

Simply write your widget as a function like shown before, decorated by @widget :

And then the code-generator will create a class for you to use, using the name of your function with an uppercase as the first letter:

Notice how BuildContext and Key are not present in the prototype of the function: They are optional. The generated class will still have them, but you don’t have to write things that you don’t use.

I don’t get it, what’s the point?

Basically, this means that instead of classes you can now write functions, but without the issues listed earlier. So you get the benefits of both worlds: Concise and actually works.

Sounds interesting? Go ahead and try it yourself!