amondnet / amondnet/flutter_uxcam

Bad initialization in example code, should not be in the build() function

Aberta
#3 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Java
Estrelas
0
Forks
0
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

The [example code](https://github.com/amondnet/flutter_uxcam?tab=readme-ov-file#example) is plain and simple, but it has an issue. The initialization is made in the build() function. The build() function is supposed to be free of any side effects. You have to put the initialization in a function that will be ran only once.

In this example it's the top level `StatelessWidget`, so it will not actually rebuild in regular use. However, it will surely rebuild during development when you do a hot reload. So every time a Flutter dev saves the file to hot reload the running application, your initialization code would run one more time, which is not good.

Please move the initialization code in the example to either the `main()` function or make your `MainApp` a `StatefulWidget` and move it to its `initState()` function.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.