BaseNavigationInteractor<IState, Input, AppTabType, RoutesClassType extends RoutesBase, DialogClassType extends RoutesBase, BottomSheetClassType extends RoutesBase, RouteType, DialogType, BottomSheetType, DeepLinksInteractorType extends BaseDeepLinksInteractor> class
abstract
Base class for navigation interactor Contains state and input parameters as every other interactor Also you need to specify type parameters for tabs, routes, dialogs and bottom sheets
You need to specify custom route builder or provide UINavigationSettings values at app startup
Example:
@singleton
@AppNavigation(tabs: AppTab)
class NavigationInteractor
extends NavigationInteractorDeclaration<NavigationState> {
@override
AppTab? get currentTab => state.currentTab;
@override
Map<AppTab, GlobalKey<NavigatorState>> get currentTabKeys => {
AppTabs.posts: GlobalKey<NavigatorState>(),
AppTabs.likedPosts: GlobalKey<NavigatorState>(),
};
@override
NavigationInteractorSettings get settings => NavigationInteractorSettings(
initialRoute: RouteNames.home,
tabs: AppTabs.tabs,
tabViewHomeRoute: RouteNames.home,
initialTabRoutes: {
AppTabs.posts: RouteNames.posts,
AppTabs.likedPosts: RouteNames.likedPosts,
},
appContainsTabNavigation: true,
);
@override
Future<void> onBottomSheetOpened(Widget child, UIRouteSettings route) async {
// ignore
}
@override
Future<void> onDialogOpened(Widget child, UIRouteSettings route) async {
// ignore
}
@override
Future<void> onRouteOpened(Widget child, UIRouteSettings route) async {
if (route.global) {
app.eventBus.send(GlobalRoutePushedEvent(replace: route.replace));
}
}
@override
void setCurrentTab(AppTab tab) {
updateState(state.copyWith(currentTab: tab));
}
@override
NavigationState get initialState => NavigationState(
currentTab: AppTabs.posts,
);
}
- Inheritance
-
- Object
- EventBusReceiver
- MvvmInstance<
Input?> - BaseInteractor<
IState, Input> - BaseNavigationInteractor
Constructors
Properties
-
allDependenciesReady
→ Observable<
bool> -
Observable holding value of successfull dependencies initialization
finalinherited
-
allPartsReady
→ Observable<
bool> -
Observable indicating that all parts are connected to this instance
finalinherited
-
Global key for main app bottom sheets and dialogs navigator
latefinal
- bottomSheets → BottomSheetClassType
-
Settings for app navigation
no setter
- configuration → DependentMvvmInstanceConfiguration
-
DependentMvvmInstanceConfiguration for this instance
no setterinherited
- currentTab → AppTabType?
-
Currently selected tab
no setter
-
currentTabKeys
↔ Map<
AppTabType, GlobalKey< NavigatorState> > -
Contains global keys for every tab in app
getter/setter pair
- deepLinks → DeepLinksInteractorType
-
Deeplinks interactor for global app
throws exception if deeplinks interactor not used
latefinal
- dialogs → DialogClassType
-
Settings for app navigation
no setter
-
Global key for main app global navigator
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialState → IState
-
Initial state for this instance
no setterinherited
- input ↔ Input?
-
Input for this instance
latefinalinherited
- isAsync → bool
-
Getter that returns true if instance contains async parts
or require async initialization
no setterinherited
- isDisposed ↔ bool
-
Flag indicating that this instance is disposed
getter/setter pairinherited
- isInBottomSheetDialogScope → bool
-
Checks if latest route is bottom sheet or dialog
no setter
- isInitialized ↔ bool
-
Flag indicating that this instance is fully initialized
getter/setter pairinherited
- isPaused ↔ bool
-
getter/setter pairinherited
-
Main navigation stack that holds navigation history for every navigator
latefinal
-
requests
→ List<
BaseRequest> -
Collection of requests running in this instance
finalinherited
-
routeObserver
→ RouteObserver<
ModalRoute< void> > -
main route observer for app
final
- routes → RoutesClassType
-
Settings for app navigation
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
savedStateObject
→ Map<
String, dynamic> -
Model as json to be saved to cache
no setterinherited
- settings → NavigationInteractorSettings
-
Settings for app navigation
no setter
- state → IState
-
Current
State
objectno setterinherited - stateFulInstanceSettings → StateFulInstanceSettings
-
Settings for state - contains cache id and flags to await initialization if needed
no setterinherited
-
stateStream
→ Stream<
IState> -
Stream of all state updates
no setterinherited
Methods
-
cancelAllRequests(
) → void -
Cancels all requests in local requests collection
inherited
-
cancelPendingOperations(
) → void -
Cancels all operations in current queue
inherited
-
canPop(
{bool global = true}) → bool - Checks if route can be popped
-
changes<
Value> (Value mapper(IState state)) → Stream< StoreChange< Value> > -
Stream of changes (a pair of previous and current values of
State
) for givenState
mapperinherited -
checkEventWasReceived(
Type event, {int? count}) → bool -
Returns true if underlying events list contains given event name
inherited
-
cleanupReceivedEvents(
) → void -
Cleans collection of received events
inherited
-
connectModule<
T extends InstancesModule> () → T -
inherited
-
containsGlobalRoute(
Object routeName) → bool - Checks if global navigator contains given route
-
defaultRouteStack(
) → List< UIRouteModel> - Default stack for global navigator
-
defaultTabRouteStack(
) → Map< AppTabType, List< UIRouteModel> > - Default stacks for every tab navigator
-
dispose(
) → void -
Base method for instance dispose
inherited
-
disposeDependencies(
) → void -
Disposes all dependencies
inherited
-
disposeStore(
) → void -
Closes underlying stream subscriptions for Store and EventBus
inherited
-
disposeSub(
) → void -
Closes underlying stream subscription for EventBus
inherited
-
enqueue(
{bool discardOnDispose = true, Duration? timeout, required Future< void> operation(), FutureOr<void> onTimeout()?}) → Future<void> -
Executes operation in sync meaning that if you wrap any code in this function
the code will be executed in place if currently there are no other operations running
otherwise function will add operation to queue and it will be executed after all previously executed operations are completed
inherited
-
executeAndCancelOnDispose<
T> (BaseRequest< T> request) → Future<Response< T> > -
Executes request and adds it in local requests collection
inherited
-
getAsyncLazyLocalInstance<
T extends MvvmInstance> ({int index = 0}) → Future< T> -
Returns connected instance of given type
inherited
-
getFullConnectorsList(
) → List< Connector> -
Returns list of dependencies from every module
and combines it with local dependencies
inherited
-
getFullPartConnectorsList(
) → List< PartConnector> -
Returns list of parts from every module
and combines it with local parts
inherited
-
getLazyLocalInstance<
T extends MvvmInstance> ({int index = 0}) → T -
Returns connected instance of given type
inherited
-
getLocalInstance<
T extends MvvmInstance> ({int index = 0}) → T -
Returns connected instance of given type
inherited
- Returns navigator key based on current navigation state
- Returns global key of navigator for given tab
-
homeBackButtonGlobalCallback(
) → void - Handles system back button events
-
initialize(
Input? input) → void -
Base method for instance initialization
override
-
initializeAsync(
) → Future< void> -
Base method for async instance initialization
inherited
-
initializeDependencies(
) → void -
Initializes all dependencies and increase reference count in ScopedContainer
inherited
-
initializeDependenciesAsync(
) → Future< void> -
inherited
-
initializeInstanceParts(
) → void -
Adds parts to local collection
inherited
-
initializeInstancePartsAsync(
) → Future< void> -
Adds parts to local collection
inherited
-
initializeStatefulInstance(
) → void -
Initializes underlying Store for given
State
inherited -
initializeStore(
) → void -
Initializes underlying Store for given
State
inherited -
initializeSub(
) → void -
inherited
-
initializeWithoutConnections(
Input? input) → void -
Base method for lightweight instance initialization
inherited
-
initializeWithoutConnectionsAsync(
) → Future< void> -
Base method for lightweight async instance initialization
inherited
-
initStack(
) → void - Initializes stack with NavigationInteractorSettings.initialRoute
-
isInGlobalStack(
{bool includeBottomSheetsAndDialogs = true}) → bool - Checks if navigator now in global stack or in tab stack
-
latestGlobalRoute(
) → UIRouteModel - Latest route in global stack
-
latestTabRoute(
) → UIRouteModel - Latest route in current tab
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
on<
T> (EventBusSubscriber< T> processor, {bool reactsToPause = false, bool firesAfterResume = true}) → EventBusSubscriber -
Subscribes to event of given type
inherited
-
onAllDependenciesReady(
) → void -
Runs after every async instance is initialized
inherited
-
onAllPartReady(
) → void -
Runs for every async part when it is initialized
inherited
-
onAsyncInstanceReady(
Type type, int? index) → void -
Runs for every async instance when it is initialized
inherited
-
onAsyncPartReady(
Type type, int? index) → void -
Runs for every async part when it is initialized
inherited
-
onBottomSheetOpened(
Widget child, UIRouteSettings route) → Future< void> - Callback for new bottom sheet
-
onDialogOpened(
Widget child, UIRouteSettings route) → Future< void> - Callback for new dialog
-
onRestore(
Map< String, dynamic> savedStateObject) → void -
Callback to get cache object
inherited
-
onRouteOpened(
Widget child, UIRouteSettings route) → Future< void> - Callback for new route in any navigation stack
-
openLink(
String link, {bool preferDialogs = false, bool preferBottomSheets = false, bool? fullScreenDialog, bool? replace, bool? replacePrevious, bool? uniqueInStack, bool? forceGlobal, bool? needToEnsureClose, bool? dismissable, Object? id, NavigationRouteBuilder? customRouteBuilder}) → Future< bool> - Tries to open link based on routes declaration and open mapped route
-
pauseEventBusSubscription(
) → void -
Sets paused flag to false so events stop processing
inherited
-
pop(
{dynamic payload, bool onlyInternalStack = false}) → void - Pops latest route from current navigation stack
-
popAllDialogsAndBottomSheets(
) → void - Pops all dialogs bottom sheets
- Pops every route in every navigator to root view
-
popAllTabsToFirst(
) → void - Pops all tabs to root view
-
popGlobalToFirst(
) → void - Pops all dialogs bottom sheets and global routes
-
popGlobalUntil(
Object routeName) → void -
Pops every global route dialog and bottom sheet until current route name is
routeName
-
popInTab(
AppTabType tab, {dynamic payload, bool onlyInternalStack = false}) → void - Pops latest route in given tab
-
popInTabToFirst(
AppTabType appTab, {bool clearStack = true}) → void - Pops all dialogs bottom sheets and global routes in given tab
-
popInTabUntil(
Object routeName) → void -
Pops every tab route dialog and bottom sheet until current route name is
routeName
in given tab -
popToTab(
AppTabType tab) → void - Pops all dialogs bottom sheets and global routes and opens given tab
-
popUntil(
Object routeName, {bool forceGlobal = false}) → void -
Pops every route dialog and bottom sheet until current route name is
routeName
-
restoreCachedStateAsync(
) → Future< void> -
Tries to restore cached state
inherited
-
restoreCachedStateSync(
) → void -
Tries to restore cached state
inherited
-
resumeEventBusSubscription(
{bool sendAllEventsReceivedWhilePause = true}) → void -
Resumes events processing
inherited
-
routeTo(
UIRoute< RouteType> routeData, {bool? fullScreenDialog, bool? replace, bool? replacePrevious, bool? uniqueInStack, bool? forceGlobal, bool? needToEnsureClose, bool? dismissable, Object? id, NavigationRouteBuilder? customRouteBuilder, bool awaitRouteResult = false}) → Future - Opens new route
-
setCurrentTab(
AppTabType tab) → void - Sets current tab for this navigator
-
showBottomSheet(
UIRoute< BottomSheetType> bottomSheet, {bool? forceGlobal, bool? dismissable, bool? uniqueInStack, Object? id, NavigationRouteBuilder? customRouteBuilder}) → Future - Opens new bottom sheet
-
showDialog(
UIRoute< DialogType> dialog, {bool? forceGlobal, bool? dismissable, bool? uniqueInStack, Object? id, NavigationRouteBuilder? customRouteBuilder}) → Future -
subscribe(
) → List< EventBusSubscriber> -
Map of EventBus events and function to be executed for this events
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updates<
Value> (Value mapper(IState state)) → Stream< Value> -
Stream of values for given
State
mapperinherited -
updateState(
IState state) → void -
Updates state in underlying Store
inherited
-
useInstancePart<
InstancePartType extends BaseInstancePart< (dynamic, MvvmInstance> >{int index = 0}) → InstancePartType -
Returns initialized instance part for given type
inherited
-
waitTillEventIsReceived(
Type event, {int? count, Duration timeout = const Duration(seconds: 1)}) → Future< void> -
Waits till given event is received by this instance
inherited
-
wrapChanges<
ChangeValue, Value> ({required ChangeValue changeMapper(IState), required Value stateMapper(StoreChange< ChangeValue> ), required Value currentMapper(IState)}) → StateStream<Value> -
StateStream object for changes with given mapper for instance state
inherited
-
wrapUpdates<
Value> (Value mapper(IState)) → StateStream< Value> -
StateStream object for updates with given mapper for instance state
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited