disposable_lazy_indexed_stack 1.0.1 copy "disposable_lazy_indexed_stack: ^1.0.1" to clipboard
disposable_lazy_indexed_stack: ^1.0.1 copied to clipboard

A Flutter widget that builds only the active child and disposes the previous ones — ideal for memory-efficient tabs and navigation.

example/lib/main.dart

import 'package:disposable_lazy_indexed_stack/disposable_lazy_indexed_stack.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: const MyHomePage());
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: DisposableLazyIndexedStack(
        index: 1,
        builders: [
          (_) => Text('test text'),
          (_) => Container(width: 15, height: 15, color: Colors.red),
          (_) => ElevatedButton(onPressed: () {}, child: Icon(Icons.add)),
        ],
      ),
    );
  }
}
1
likes
160
points
23
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter widget that builds only the active child and disposes the previous ones — ideal for memory-efficient tabs and navigation.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on disposable_lazy_indexed_stack