Flutter Flash News (09/2024)
 Flutter Flash News (09/2024)
 Flutter Flash News (09/2024)

Flutter Flash News (09/2024)

Flutter

Flutter

Flutter

In our September issue, we shed light on strenuous form creation in Flutter and the heated debate around Builder pattern.

Sep 19, 2024

Is Builder pattern anti-pattern?

Matt Caroll of FlutterBounty Hunters has published an article with an intriguing central idea –Builder pattern doesn't belong in the Widget tree.

At Netglade, we partially agree.

In the previous edition of Flutter Flash News, we mentioned a "Tailwind" for Flutter – Fluttermix, which builds on the Builder Pattern. However, creating a Flutter widget tree this way becomes less clear, as no clear order of widgets is given.

At the same time, we admit to using the builder pattern in some cases, mostly through the flutter_animate package.

IDEs are once again smarter

Our developer Honza Bittner got tired of the IDE not being able to remove widgets automatically for Column/Row or Slivers. The only way he managed to contain his anger was by creating a Pull Request to the Dart SDK that adds this function: GitHub - Pull Reguest #56638: feat: make remove widget work for slivers.

Let’s hope we see it in a stable version soon. 🤞

Is const really a performance boost?

An interesting issue was recently brought up, suggesting to remove lint rules on const from the default rules package. Why? Because const doesn't add any significant boost to the application, and, on the contrary, it very often hinders developers during development.

I'm sure you've also experienced editing a widget and half the IDE suddenly turning red because some parent widget was const and can no longer be.

Personally, we don't mind these lints too much, especially thanks to DCM and its automatic fixing. However, I’ll closely follow the issue, curious to see where the discussion goes.

Creating forms in Flutter is a hassle?

If there’s anything in Flutter that we can call tedious, it's creating forms. And that form doesn't have to be complicated. Even just a request for translation errors or validation of an input can be an ordeal.

You need to create a Statefull widget, for each TextEditingController, and not forget to dispose(). We can try doing it through flutter_hooks, but we’ll run into issues as well, finding that we need to share some inputs, or at least validate them.

But don’t worry – you’re not alone.

Recently on Twitter (X, forever Twitter for us 😌), user Casey Rogers shared this tweet.

The post discussion uncovers the crux of the problem – the "vanilla" route is inconvenient and people hurry to find alternatives.

At Netglade, we've been using our own forms library for a while now – glade_forms. It includes support for fluent api for defining validations, dependent validators, translations, and much more.

As always, we'd be happy if you'd give it a shot. 😉

That’s all for now. See you in the next spooky edition of Flutter Flash News. 🎃