DisposableLazyIndexedStack
A lightweight Flutter widget that works like an IndexedStack, but with two important differences:
✅ Lazy building → Children are only built when needed.
✅ Disposable children → Previous widgets are fully disposed when replaced.
This makes it ideal for tab navigation or page switching scenarios where you don’t want to keep all screens in memory.
✨ Features
- 🚀 Lazily builds only the current child.
- 🗑️ Disposes previous child widgets when index changes.
- 🎯 Keeps memory usage low (unlike
IndexedStack, which keeps all children alive). - 🔄 Perfect for tab views, navigation flows, or conditional screens.
📦 Installation
Add this to your pubspec.yaml:
dependencies:
disposable_lazy_indexed_stack: ^1.0.0