Skip to main content

PageStorageKey

Struct PageStorageKey 

Source
pub struct PageStorageKey { /* private fields */ }
Expand description

A Key that can be used to persist the widget state in storage after the destruction and will be restored when recreated.

Each key with its value plus the ancestor chain of other PageStorageKeys need to be unique within the widget’s closest ancestor PageStorage. To make it possible for a saved value to be found when a widget is recreated, the key’s values must not be objects whose identity will change each time the widget is created.

Dart’s PageStorageKey<T> extends ValueKey<T>; the value type is erased inside, as GlobalKey’s is.

See also:

  • RestorationManager, which manages state restoration.

Implementations§

Source§

impl PageStorageKey

Source

pub fn new<T: PartialEq + Hash + Debug + 'static>(value: T) -> PageStorageKey

Creates a PageStorageKey.

The value is the value to which this key delegates its equality.

Source

pub fn into_key(self) -> KeyRef

The key as a tree node’s key.

Trait Implementations§

Source§

impl Debug for PageStorageKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Key for PageStorageKey

Source§

fn eq_key(&self, other: &dyn Key) -> bool

Flutter’s operator ==. Must return false when other is a different concrete key type, even if the two carry the same value.
Source§

fn hash_key(&self, state: &mut dyn Hasher)

Flutter’s hashCode. Must mix in the concrete key type so that two key types carrying the same value do not collide.
Source§

impl LocalKey for PageStorageKey

Auto Trait Implementations§

§

impl !RefUnwindSafe for PageStorageKey

§

impl !Send for PageStorageKey

§

impl !Sync for PageStorageKey

§

impl !UnwindSafe for PageStorageKey

§

impl Forget for PageStorageKey

§

impl Freeze for PageStorageKey
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze,

§

impl Move for PageStorageKey

§

impl Unpin for PageStorageKey
where Rc<dyn Key>: Unpin,

§

impl UnsafeUnpin for PageStorageKey
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>