Image for post
Image for post

Update: This article is now part of the official Flutter documentation. It was also translated to Russian by Kirill Matrosov.

When someone learning Flutter asks you why some widget with width:100 is not 100 pixels wide, the default answer is to tell them to put that widget inside of a Center, right?

Don’t do that.

If you do it, they will come back again and again, asking why some FittedBox is not working, why that Column is overflowing, or what IntrinsicWidth is supposed to be doing.

Instead, first tell them that Flutter layout is very different from HTML layout (which is probably where they’re coming from), and then make them memorize the following…


Image for post
Image for post

Usando Dart Extension Methods!

English version

Se você tem um widget com algum texto nele:

Text("Olá, como vai você")

Para traduzir basta escrever .i18n depois do texto:

Text("Olá, como vai você".i18n)

Se o locale do aplicativo é en_US (inglês americano) então o texto na tela vai aparecer traduzido para "Hello, how are you". E assim por diante para todos os locales que você quiser suportar.

Isso é possível através do meu pacote i18n_extension, que para minha surpresa foi citado pelo Google no anúncio do Dart 2.7.

Você também pode definir diferentes traduções dependendo de modificadores, por exemplo usando plural() para descrever diferentes quantidades de…


Image for post
Image for post

Unleash the power of Dart extensions

I’m always interested in creating packages to reduce boilerplate. For example, async_redux is about Redux without boilerplate, and align_positioned is about creating layouts with less widgets.

In this article I talk about the i18n_extension package which is about non-boilerplate translations. This package was mentioned by Google during the Dart 2.7 announcement.

Start with a widget with some text in it:

Text("Hello, how are you?")

Translate it simply by adding .i18n to the string:

Text("Hello, how are you?".i18n)

If the current locale is pt_br then the text in the screen will be
"Olá como vai você" which is the Portuguese translation to the above text. …


A maneira fácil de gerenciar estado num aplicativo Flutter.

O AsyncRedux é uma versão especial de Redux que:

  1. É fácil de aprender
  2. É fácil de usar
  3. É fácil de testar
  4. Não tem boilerplate

Este texto assume que você já conhece Redux e Flutter, e serve apenas para te explicar em linhas gerais porque o AsyncRedux é melhor que o Redux comum e pode ser a forma mais fácil para você gerenciar estado nos seus aplicativos. Se você quer todos os detalhes e funcionalidades, por favor veja a publicação do Pacote AsyncRedux para Flutter.

Declare a sua store e state assim:

var state = AppState.estadoInicial();var store = Store<AppState>(
initialState: state…


AsyncRedux is a special version of Redux which:

  1. Is easy to learn
  2. Is easy to use
  3. Is easy to test
  4. Has no boilerplate

AsyncRedux is currently used in a large-scale project I’m involved in, and I finally took the time to write its documentation and publish it. I’ll assume you already know Redux and Flutter, and need to quickly understand some of what AsyncRedux has to offer. If you want all of the details and features, please go to the AsyncRedux Flutter Package.

The most obvious feature of AsyncRedux is that there is no middleware, since reducers can be both sync and async. …

Marcelo Glasberg

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store