How to not start with Flutter

Some days ago I posted on twitter my biggest mistake about learning Flutter:

(Now, provider package is the new recomendation by Flutter docs)

Motivated by a lot of questions on Stack Overflow about "BLoC" pattern, I decided to share on Twitter (and surprisingly got some nice feedbacks) and now write this post to help future flutter developers.

Almost every single day, newcomers on flutter post questions about "BLoC" or even worst, about packages that makes "simple" to implement this pattern.

You have other topics that really matter in the beginning:

  • Dart language (even if it is not hard)
  • Widget tree
  • Box Constraints
  • Basic widgets
  • Stateless and Stateful widgets
  • Navigation
  • Widgets lifecycle
  • Material and Cupertino packages
  • Keys

When you need to share values between widget or pass them down in your widget tree, use InheritedWidget, it is easy and probably meet what you need in the first steps. If you already use MediaQuery.of(context) or Theme.of(context), you already used InheritedWidget.

And even after having good knowledge about topics above, when you started with state management, there are excellent packages to start: scoped_model and the most recent and powerful provider. I strongly recommended scoped_model. It is simple to understand, well documented, works fine for small and medium apps (no matter how complexity app is) and was explicitly the first package about state management recommended by Flutter docs (and now provider is the new black).

Keep in mind that state management isn't a simple topic, there isn't a better approach and Flutter let you chose whatever solution you want. And the most important on your journey is to discover what solution fits your needs and what solution you feel more comfortable and confident to use in your app.

In conclusion, would like to point that this article is not against Bloc pattern (definitely not). It is just an advice for those who are arriving in Dart & Flutter side and may be frustrated trying to implement Bloc when they don't need.

Rubens Melo

db2 z/os admin, cobol/java developer, flutter enthusiast, frontend newbie

Write your comment…

Rubens Melo,

Yeah, I second that. I am couple of months old to Flutter and saved myself from falling into the trap of it. Understanding actual need of BLOCK is important. I liked your list of other topics mentioned.

Nice Post!

Reply to this…