Skip to content

Commit a3decc4

Browse files
committed
docs: update README to reflect autoDisposeIndexes feature
- Updated documentation to replace `forceReloadIndexes` with `autoDisposeIndexes`. - Added explanation of the `autoDisposeIndexes` feature under the Features section. - Updated example code to include `autoDisposeIndexes` usage. - Improved parameter descriptions and provided real-world use case examples.
1 parent bf4f1eb commit a3decc4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ A package that extends IndexedStack to allow for lazy loading and provides enhan
77

88
## Motivation
99

10-
If you use the IndexedStack with bottom navigation, all the widgets specified in the children of the IndexedStack will be built.
10+
If you use the IndexedStack with bottom navigation, all the widgets specified in the children of the IndexedStack will be built.
1111

12-
Moreover, if the widget requires API requests or database access, or has a complex UI, the IndexedStack build time will be significant.
12+
Moreover, if the widget requires API requests or database access, or has a complex UI, the IndexedStack build time will be significant.
1313

14-
Therefore, we created an extended IndexedStack that builds the required widget only when it is needed, and returns the pre-built widget when it is needed again. With the newly added features, you can now also force specific child widgets to reload or manage widget updates dynamically.
14+
Therefore, we created an extended IndexedStack that builds the required widget only when it is needed and returns the pre-built widget when it is needed again.
1515

1616
## Features
1717
* **Lazy Loading**: The main feature of `LazyLoadIndexedStack` is to build children widgets only when they are needed, reducing initial load time.
1818
* **Preloading**: With the `preloadIndexes` parameter, you can specify indexes of children that should be built in advance, even if they are not currently visible. This is useful for preloading widgets that are likely to be needed soon.
19-
* **Forced Reloading**: Using the `forceReloadIndexes` parameter, you can specify which child widgets should be forcibly rebuilt when needed. This is helpful for dynamic data loading or resetting specific widgets.
19+
* **Auto Disposal**: The `autoDisposeIndexes` parameter allows specific children to be automatically disposed of when they are no longer visible. When these children are accessed again, they will be rebuilt from scratch. This is useful for cases where widgets hold significant state or require resetting when revisited.
2020

2121
## Usage
22-
You can use `LazyLoadIndexedStack` in the same way as `IndexedStack`, with additional options for preloading and forced reloading.
22+
You can use `LazyLoadIndexedStack` in the same way as `IndexedStack`, with additional options for preloading and auto dispose.
2323

2424
### Basic Example
2525
```dart
@@ -38,11 +38,11 @@ class _MainPageState extends State<MainPage> {
3838
body: LazyLoadIndexedStack(
3939
index: _index,
4040
preloadIndexes: const [3],
41-
forceReloadIndexes: const [1, 2], // Force reload for index 1 and 2
41+
autoDisposeIndexes: const [1, 2],
4242
children: [
4343
Page1(),
44-
Page2(), // index 1 will be reloaded as specified
45-
Page3(), // index 2 will also be reloaded
44+
Page2(), // index 1 will be auto dispose
45+
Page3(), // index 2 will also auto dispose
4646
Page4(), // index 3 is preloaded
4747
],
4848
),

0 commit comments

Comments
 (0)