lazy_load_indexed_stack
1.2.1, released 2 years ago by okaryo.studio
An extended IndexedStack widget that supports lazy loading, preloading, and auto-disposal.
WASM-ready
What it does
Extends IndexedStack to build child widgets only when needed instead of initializing all children simultaneously. It supports custom preloading of specific indexes and automatically disposing unused children.
AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You use bottom navigation bars with multiple tabs backed by an IndexedStack.
- Your IndexedStack children perform heavy API requests or database access on initialization.
- You need to optimize initial load times by deferring the creation of hidden views.
Skip it when
- You need to preserve the exact UI state of every tab instantly without ever rebuilding them.
- Your stack contains only a couple of very lightweight widgets.
Strengths
- Reduces initial build time by lazily loading child widgets.
- Allows fine-grained control via preloading and auto-disposal parameters.
- Drop-in replacement style usage similar to standard IndexedStack.
Weaknesses
- Auto-disposing children means their state will be lost when they are no longer visible unless managed externally.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
LazyLoadIndexedStack(
index: _index,
preloadIndexes: [1, 2],
autoDisposeIndexes: [2, 3],
children: [
Page1(),
Page2(),
Page3(),
Page4(),
],
)Alternatives
Packages that do the same job and could replace lazy_load_indexed_stack.
- flutter_lazy_indexed_stack
An IndexedStack widget that loads children lazily only when needed.
57Compare - easy_animated_indexed_stack
Drop‑in replacement for IndexedStack with animated transitions
46Compare - rounded_loading_button_plus
Animated button with loading, success and error states for Flutter.
50Compare