As a Flutter developer I’m sure you heard about this popular sentence: “Everything’s a Widget” at least once in your dev life. It’s kind of the Flutter’s catch phrase and it reveals the inner force of this extraordinarily good SDK!
When we dive in the Widget catalog, we can see a lot of small widgets doing only one job such as
SizedBox, and so on. We create other widgets by composing them and I find this approach scalable, powerful and easy to understand.
But when I read some source code I find on the Internet or written by newly adopters, there is one thing that shock me a lot: the tendency to have huge
build methods, instantiating a lot of widgets! …
In a previous blog post I introduced Maestro which is for now an experiment to manage you app state in a Flutter application.
Today I will show you how to use the power of Freezed ⚡️ to create the models and the states. I will not explain in details how this library works but I will show you how easily we can create immutable objects with it!
Freezed is a great library created by Remi Rousselet for generating all the boilerplate code you want for immutable objects and even more!
We already have a huge bunch of options for managing our app state in Flutter, so you could wonder why spend some time on another one?
The reason is simple: I love creating things, I can’t stop. Sometimes I find myself thinking about what I could make when I rock my daughter to sleep. Sometimes it can be useful, other times it’s not but I still have learned something in the end.
Today I want to tell you the story of Maestro and you will decide whether it can help you or not. …
I love how Flutter is designed. The combination of immutables objects, the
Widgets and mutables ones called
RenderObjects is very powerful although not super intuitive for beginners.
We can do a lot just by composing widgets with
StatefulWidgets, but we cannot do everything, or not in an efficient way. That’s why you need to understand how to create your own
RenderObject when it’s necessary.
In this post I will not explain what is the difference between a
Widget and a
RenderObject but I will show you how I created a simple
RenderObject in order for you to do the same when you need it. …
Animations can turn a great app into an astounding and unforgettable one. They are a big part of the user experience and without them, an application doesn’t really look attractive.
Thanks to Flutter, it’s easier than ever to animate the UI of your app in order to reinforce the user’s action.
For example, it’s pretty straightforward to create a transition between two screens by animating a common element with the Hero widget:
When I started to learn Dart, the concept of mixins was new for me.
I come from the C# world, where it does not exist (at least prior to C# 8.0, to the best of my knowledge).
At first, I found this concept somewhat difficult to understand, until I realized how powerful it was.
Disclaimer: Mixins specifications are evolving in Dart 2. Some of the following content might not be applicable at the time of reading this.
If languages such as C# do not have mixins, it probably isn’t that useful, is it?
Let’s have a look at the following class inheritance…
Even if I’m writing a small application, I tend to separate the logic from the UI. Because projects grow, I think it’s a good practice to do this if the project is not a proof of concept.
I like to have small services with one responsibility. It’s easier to test, to maintain, to read, to understand. A problem with this principle is that you end up with services having a lot of dependencies. Creating such a service can be tedious if you have to instantiate all the dependencies before calling the constructor. …
In a previous article, I explained how I reproduced the iOS sliding row animation in Flutter, through my Slidable widget. In that article I used some animations to illustrate my words and today I’m going to show you how I created them.
I first looked for animations tools, but I didn’t want anything complicated, nor invest money and time for such simple animations. So I thought “Why do not just use Flutter?”
I tried something and it was really easy to create the animations I wanted, so I entirely coded my animations in Dart using Flutter 😄, isn’t it beautiful? …
In the Slidable widget, the developer can choose how the slide actions animate through what I named SlidableDelegates. The SlidableDrawerDelegate is one of the built-in ones:
This is the story behind the creation of the Slidable widget (available here). A widget that let you add contextual actions on your list items when you are sliding it to the left or to the right.
I’m a passionate developer. This is what I do for living, but it’s mostly my main hobby ❤️. Some express themselves through words, drawings, music, I express myself through code. I’m more comfortable with variables and functions than with a ball or a racket. This is who I am.
We are in July 2018. It’s sunny ☀️ and kinda hot here in Brittany, France, but instead of enjoying the sun and going to the beach, I’m craving to learn something new and to code. …