createBackStack
Creates a back stack: a stack that always has a current entry (the one on top), with the
previous ones underneath to go back to. The bottom entry is never removed, so there is always
something to show: screens of a prototype, overlays stacked over a screen (with null as the
initial entry), wizard steps, undo levels.
It does not decide what the next entry is: compute it (with a state machine, a router, …)
and push it.
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
initial | T | The first current entry, also the default of BackStack.reset |
options | BackStackOptions | Depth limit — see BackStackOptions |
Returns
Section titled “Returns”BackStack<T> — A BackStack
Examples
Section titled “Examples”Navigate and go back
Section titled “Navigate and go back”push() moves to a new entry; back() returns the entry it left and restores the previous one.
Change the current entry without a step to undo
Section titled “Change the current entry without a step to undo”replace() swaps the current entry and keeps the ones underneath; previous is where back() would go.
Bound the stack
Section titled “Bound the stack”limit caps how many past entries are kept; the oldest are dropped first.
Related Types
Section titled “Related Types”BackStack
Section titled “BackStack”A back stack created by createBackStack.
BackStackOptions
Section titled “BackStackOptions”Options for createBackStack.
