Skip to main content

RestorableRouteFuture

Struct RestorableRouteFuture 

Source
pub struct RestorableRouteFuture {
    pub navigator_finder: NavigatorFinderCallback,
    pub on_present: RoutePresentationCallback,
    pub on_complete: Option<RouteCompletionCallback>,
    /* private fields */
}
Expand description

Gives access to a Route object and its return value that was added to a navigator via one of its restorable* methods.

When a router is pushed with one of those methods, they return a restoration ID. That ID can be used to obtain a RestorableRouteFuture, which stays valid across state restoration.

Fields§

§navigator_finder: NavigatorFinderCallback

A callback that given the BuildContext of the State object to which this property is registered returns the NavigatorState of the navigator the route should be added to.

§on_present: RoutePresentationCallback

A callback that adds a route to the navigator and returns its restoration ID.

§on_complete: Option<RouteCompletionCallback>

A callback that is invoked when the route added by on_present completes.

Implementations§

Source§

impl RestorableRouteFuture

Source

pub fn new( app: &mut App, on_present: RoutePresentationCallback, ) -> Ref<RestorableRouteFuture>

Creates a RestorableRouteFuture; Dart’s optional arguments are the setters.

Source

pub fn set_navigator_finder( self: Handle<Self>, app: &mut App, navigator_finder: NavigatorFinderCallback, )

Dart RestorableRouteFuture(navigatorFinder:).

Source

pub fn set_on_complete( self: Handle<Self>, app: &mut App, on_complete: RouteCompletionCallback, )

Dart RestorableRouteFuture(onComplete:).

Source

pub fn present( self: Handle<Self>, app: &mut App, arguments: Option<RestorationData>, )

Shows the route created by on_present.

Source

pub fn is_present(self: Handle<Self>, app: &App) -> bool

Whether the route is currently shown.

Source

pub fn route(self: Handle<Self>, app: &App) -> Option<AnyRoute>

The route the on_present callback added to the navigator.

Trait Implementations§

Source§

impl ChangeNotifier for RestorableRouteFuture

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl RestorableProperty for RestorableRouteFuture

Source§

type Value = Option<String>

The object this property wraps; Dart’s type argument T.
Source§

fn restorable_property_data( self: Handle<Self>, app: &App, ) -> &RestorablePropertyData

The registration with a RestorationMixin, held under the field property (restorable_property_accessors!).
Source§

fn restorable_property_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut RestorablePropertyData

Source§

fn create_default_value(self: Handle<Self>, _app: &mut App) -> Option<String>

Called by the RestorationMixin if no restoration data is available to restore the value of the property from, to obtain the default value for the property. Read more
Source§

fn from_primitives( self: Handle<Self>, _app: &mut App, data: &RestorationData, ) -> Option<String>

Called by the RestorationMixin to convert the data previously retrieved from to_primitives back into an object of type Value that this property should wrap. Read more
Source§

fn init_with_value(self: Handle<Self>, app: &mut App, value: Option<String>)

Called by the RestorationMixin with the value returned by either create_default_value or from_primitives to set the value that this property currently wraps. Read more
Source§

fn to_primitives(self: Handle<Self>, app: &App) -> RestorationData

Called by the RestorationMixin to retrieve the information that this property wants to store in the restoration data. Read more
Source§

fn enabled(self: Handle<Self>, app: &App) -> bool

Whether the object currently returned by to_primitives should be included in the restoration state. Read more
Source§

fn did_dispose(self: Handle<Self>, app: &mut App)

Runs at the end of dispose: what a Dart override does after its super.dispose() call.
Source§

fn dispose_property(self: Handle<Self>, app: &mut App)

Dart’s RestorableProperty.dispose body. An override that runs super.dispose() calls this.
Source§

fn dispose(self: Handle<Self>, app: &mut App)

Discards any resources used by the property, unregistering it from its owner.
Source§

fn state(self: Handle<Self>, app: &App) -> AnyRestorationMixin

The State object that this property is registered with. Read more
Source§

fn is_registered(self: Handle<Self>, app: &App) -> bool

Whether this property is currently registered with a RestorationMixin.
Source§

fn as_property(self: Handle<Self>) -> AnyRestorableProperty

This property as the erased AnyRestorableProperty — what to pass where a Dart API takes a RestorableProperty<Object?>.

Auto Trait Implementations§

§

impl !RefUnwindSafe for RestorableRouteFuture

§

impl !Send for RestorableRouteFuture

§

impl !Sync for RestorableRouteFuture

§

impl !UnwindSafe for RestorableRouteFuture

§

impl Forget for RestorableRouteFuture

§

impl Freeze for RestorableRouteFuture
where *const u8 is !null: Freeze, PhantomData<Option<Listener>>: Freeze, *const RcInner<Cell<usize>> is !null: Freeze, PhantomData<RcInner<Cell<usize>>>: Freeze, PhantomData<u8>: Freeze, NonZero<u32>: Freeze, &'static RestorationMixinVTable: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement) -> Handle<NavigatorState>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Handle<NavigatorState>>>: Freeze, *const RcInner<dyn Fn(&mut App, Handle<NavigatorState>, Option<RestorationData>) -> String> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Handle<NavigatorState>, Option<RestorationData>) -> String>>: Freeze, *const RcInner<dyn Fn(&mut App, Option<Rc<dyn Any>>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<dyn Any>>)>>: Freeze, &'static RouteVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze,

§

impl Move for RestorableRouteFuture

§

impl Unpin for RestorableRouteFuture
where *const u8 is !null: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<Cell<usize>>: Unpin, &'static RestorationMixinVTable: Unpin, Rc<dyn Fn(&mut App, AnyElement) -> Handle<NavigatorState>>: Unpin, Rc<dyn Fn(&mut App, Handle<NavigatorState>, Option<RestorationData>) -> String>: Unpin, Rc<dyn Fn(&mut App, Option<Rc<dyn Any>>)>: Unpin, &'static RouteVTable: Unpin, Rc<Keep>: Unpin,

§

impl UnsafeUnpin for RestorableRouteFuture
where *const u8 is !null: UnsafeUnpin, PhantomData<Option<Listener>>: UnsafeUnpin, *const RcInner<Cell<usize>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<usize>>>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static RestorationMixinVTable: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement) -> Handle<NavigatorState>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Handle<NavigatorState>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Handle<NavigatorState>, Option<RestorationData>) -> String> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Handle<NavigatorState>, Option<RestorationData>) -> String>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Option<Rc<dyn Any>>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<dyn Any>>)>>: UnsafeUnpin, &'static RouteVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: 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> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
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>