June é uma biblioteca leve e moderna de gerenciamento de estado que se concentra em fornecer um padrão muito semelhante ao gerenciamento de estado nativo do Flutter.
Orientação gerada a partir de informações públicas. Apenas para referência.
June é uma biblioteca leve e moderna de gerenciamento de estado para Flutter que reflete os padrões nativos de gerenciamento de estado do Flutter. Ela enfatiza simplicidade e legibilidade, tornando fácil gerenciar o estado de forma reativa sem código boilerplate. Projetada com a experiência do desenvolvedor em mente, a June se integra perfeitamente em projetos existentes do Flutter e suporta todas as principais plataformas. Sua API é intuitiva, promovendo uma estrutura de código limpa e atualizações eficientes. A June é ideal para desenvolvedores que buscam uma alternativa mínima, mas poderosa, em comparação com soluções mais complexas de gerenciamento de estado.
Casos de uso
Gerenciamento simples de estado do aplicativo
Atualizações de UI reativas
Aplicativos cross-platform do Flutter
Solução leve de estado
Integração fácil com bases de código existentes
Principais recursos
Boilerplate mínimo
Alinhamento de padrão nativo do Flutter
Atualizações de estado reativas
Platform-agnostic
API limpa e legível
Sem dependências externas
Indicado para
Desenvolvedores iniciantes a intermediários do Flutter
Aplicações pequenas a médias
Projetos que priorizam a simplicidade
Equipes que desejam onboarding rápido
Aplicativos direcionados a múltiplas plataformas
Considerações
Recursos avançados limitados em comparação com bibliotecas maiores
Não ideal para necessidades de estado em grande escala
Menos suporte da comunidade do que alternativas maduras
Mais adequado para fluxos de estado simples
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
You learned Flutter. You learned setState. It clicked.
Then you added a library and suddenly you're learning a new framework inside your framework — providers, stores, atoms, streams, reducers.
June refuses to do that.
It gives you shared, reactive state that works exactly like Flutter's own state management — just without the widget tree dependency. That's it.
At a glance
Before June — state trapped in a widget
class_CounterStateextendsState<Counter> {
int count = 0; // 🔒 only this widget// can touch this@overrideWidgetbuild(BuildContext context) {
returnText('$count');
}
}
With June — state lives anywhere, rebuilds anything
classCounterVMextendsJuneState{
int count = 0; // ✅ any widget,// any file,
} // anywhere
Each widget holds its own isolated state. Navigating away and back creates a fresh instance — exactly what you want for forms, sliders, and single-use UI.
Theme toggle
JuneBuilder can wrap MaterialApp itself, rebuilding the entire app on state change.
JuneBuilder(
() => UserController(),
builder: (c) {
if (c.loading) returnconstCircularProgressIndicator();
if (c.user == null) returnconstText('No user loaded');
returnText('Hello, ${c.user!.name}');
},
)
Selective rebuilds with id
Trigger only specific JuneBuilder widgets inside a shared state, leaving others untouched.
classFeedStateextendsJuneState{
String header = 'Latest';
List<Post> posts = [];
voidupdateHeader(String value) {
header = value;
setState('header'); // only rebuilds builders with id: 'header'
}
voidrefreshPosts(List<Post> fresh) {
posts = fresh;
setState('posts'); // only rebuilds builders with id: 'posts'
}
}
// Rebuilds only when 'header' setState is calledJuneBuilder(
() => FeedState(),
id: 'header',
builder: (s) => Text(s.header),
)
// Rebuilds only when 'posts' setState is calledJuneBuilder(
() => FeedState(),
id: 'posts',
builder: (s) => PostList(posts: s.posts),
)
Core API
Symbol
Role
JuneState
Base class for all state objects. Extend it, add fields and methods, call setState() to rebuild.
JuneBuilder
Widget that subscribes to a JuneState and rebuilds when setState() fires.
June.getState()
Retrieves (or lazily creates) a global singleton of a state type. Thread-safe, no setup needed.
tag
Namespaces multiple global instances of the same type.
id
Enables partial rebuilds — only JuneBuilder widgets sharing the same id will rebuild.
global: false
Bypasses the global registry. The builder uses your provided instance directly.
tag vs id — when to use which
tag
id
Lives on
JuneBuilder & June.getState()
JuneBuilder & setState()
Purpose
Pick which stored instance to use
Pick which builders to rebuild
Use when
Same state type needed in multiple places independently
One shared state, but only some widgets should react to a given change
Migration
0.8.x → 1.0.0
The factory function is now passed as a closure rather than an evaluated instance:
// Before (0.8.x)June.getState(CounterVM());
// After (1.0.0+)June.getState(() => CounterVM());
Community
Questions, ideas, or just want to say hi?
Acknowledgements
June was shaped by the best ideas in the Flutter ecosystem. Gratitude to the teams and communities behind Provider, GetX, Bloc, and Riverpod, and to Svelte for proving that less really is more.