MainNavigationBloc<T> class

This Bloc handles the main/top level navigation of this app. You can fire events in event.dart or use the functions in EventNavigation to call the functions indirectly.

This uses MainNavigationStrategy to decide which main navigations to accept and how to convert the T to and from a String.

This also uses deepNavigationStrategyMap to have a mapping of DeepNavigationStrategys for each individual MainNavigation that is allowed in the Bloc.

Defaults to home and will change the main navigation to home if it is attempted to change the app to an unknown state.

Constructors

defaultDeepNavigationStrategy is the strategy used when deepNavigationStrategyMap doesn't have a strategy for the currentMainNavigationStrategy

Properties

blocUpdated List<void Function()>
Add functions to this to be ran when the Bloc is updated.
getter/setter pairinherited
canPopDeepNavigation bool
no setter
currentDeepNavigation DeepNavigationNode<T>?
getter/setter pair
currentMainNavigation ↔ T
getter/setter pair
deepNavigationMap Map<T, DeepNavigationNode<T>?>
final
deepNavigationStrategyMap Map<T, DeepNavigationStrategy>
final
defaultDeepNavigationStrategy DeepNavigationStrategy
getter/setter pair
eventChannel → BlocEventChannel
Events that the UI fire to affect this Bloc are received through here.
finalinherited
failedLastNavigation bool
getter/setter pair
fullNavigation String
This is the full navigation expressed as a String. The conversion function is provided by MainNavigationStrategy
no setter
hashCode int
The hash code for this object.
no setterinherited
lastFailedFullNavigation String?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strategy MainNavigationStrategy<T>
final
undoStrategy NavigationUndoStrategy<T>
final

Methods

changeFullNavigation(String newFullNavigation, {bool updateBloc = true}) → void
Changes the current navigation to be equal to the newFullNavigation.
changeMainNavigation(T newMainNavigation, {bool logUndo = true, bool shouldUpdateBloc = true}) NavigationResult
Changes the main navigation to the newMainNavigation, if applicable.
dispose() → void
Disposes this value to save memory. Implementations should be idempotent.
inherited
fullNavigationOnMainNavigation(T mainNavigation) String
getDeepNavigationStrategy(T mainNavigation) DeepNavigationStrategy
handleDeepNavigationFromRoot(Iterable<T> subNavigations) NavigationResult
Will create a new DeepNavigationNode to assign to currentMainNavigation that starts from the base layer.
logFailedNavigation(String failedNavigation) → void
logSuccessfulNavigation() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popDeepNavigation() → void
Will attempt to pop the deep navigation node of currentMainNavigation. If currently at the base layer, this will do nothing.
pushDeepNavigation(T value, {bool shouldUpdateBloc = true}) Future<NavigationResult>
redoNavigation() → void
toString() String
A string representation of this object.
inherited
undoNavigation() → void
updateBloc() → void
Signal that this Bloc has been updated. This will call all listeners added to blocUpdated.
inherited
updateBlocOnChange({required dynamic change(), required List tracker()}) → void
Updates the Bloc after calling change if the value returned by tracker changes.
inherited
updateBlocOnFutureChange({required Future change(), required List tracker()}) Future<void>
Updates the Bloc after calling change if the value returned by tracker changes.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited