Interface INavigationService
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Navigation.dll
Provides shell navigation abstraction.
public interface INavigationService
- Extension Methods
Methods
GoToAsync(INavigationInfo)
Navigates to the specified model-name-driven path.
Task<bool> GoToAsync(INavigationInfo navigation)
Parameters
navigationINavigationInfoThe navigation to apply.
Returns
- Task<bool>
True if navigation succeeds, false if it was interrupted by guards or ignored due to a concurrent navigation.
Remarks
Must be invoked on the UI thread. Navigation creates pages, sets binding contexts and drives the
shell directly, without marshalling: calling it from a background thread is undefined behavior and will
usually crash on iOS/Android. From a background thread, wrap the call in
MainThread.InvokeOnMainThreadAsync(...) or IDispatcher.DispatchAsync(...).
Concurrent calls are safe: navigations are serialized, only one runs at a time. A call that had to wait is then re-validated against the shell location it was computed on — if another navigation moved the shell in the meantime, the queued one is dropped: it returns false and raises the NavigationIgnored event instead of applying to a state it was not intended for. Always honor the returned value rather than assuming the navigation happened.
Re-entrancy is rejected: calling this method while a navigation is in progress on the same asynchronous flow
(typically from OnEnteringAsync, OnAppearingAsync or a guard) throws
InvalidNavigationException. Dispatch the call with IDispatcher.DispatchAsync(...)
instead. Doing so from OnAppearingAsync is always safe: the engine commits the navigation — and with
it the location this method validates against — before sending the appearing event, so the dispatched
navigation starts from the final location and cannot be superseded by the one that triggered it.
Exceptions
- ArgumentNullException
Thrown if
navigationis null.- InvalidOperationException
Throw if target path is not reachable or target page model can't receive specified intent.
- InvalidNavigationException
Thrown if triggered from within an ongoing navigation.