StartupSequence class
Manages the series of processes from app launch to the display of the initial screen using LogicStateMachine. When executing StartupSequence.resetMachine, it starts execution from the first state provided in the StartupStateFactory list.
When all states succeed, StartupSequence calls StartupNavigatorMixin.startupProcessInitialRoute.
When using StandardAppPlugin, this is synonymous with calling
StandardRouterDelegate.processInitialRoute. In other words,
If a deep link was used to start the app, that deep link's page will be displayed.
If no deep link was used, the route with a link of nothing (r''
) will be navigated to.
If a link cannot be found, the first page in the StandardMaterialApp.pages array with
StandardPageFactory.group having StandardPageWithResultFactory.defaultGroup is displayed.
In the case of Web, WebPageNotFound is thrown at this point.
If these pages cannot be found, the first page in StandardMaterialApp.pages is displayed.
If the app is rendering widgets using the StandardAppPlugin system, StartupSequence.resetMachine is automatically executed only once when the app is launched.
startupStateFactories
specifies the states to be executed sequentially.
This is the same as LogicState in LogicStateMachine.
waitSplashScreenDuration
specifies the waiting time for the splash screen.
StartupState.navigateToPage or StartupNavigatorMixin.startupProcessInitialRoute
will be executed after waiting for this duration to elapse.
Also, removeNativeSplashScreen
is called once this time has passed.
(default is 1 second)
Constructors
-
StartupSequence.new({required List<
StartupStateFactory< startupStateFactories, Duration? waitSplashScreenDuration, void onSuccess()?, void onError(Object error, StackTrace? stackTrace)?})StartupState> >
Properties
- complete → bool
-
Whether the sequence has completed, successfully or due to an error.
no setter
- error → LogicStateError?
-
The details of the error that occurred during execution.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- onError → void Function(Object error, StackTrace? stackTrace)?
-
Called when an error occurs during the sequence.
If null, it will call
Logger.severe
instead.final - onSuccess → void Function()?
-
Called when all sequence processing is completed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- splashFinished → bool
-
Whether the time specified by
waitSplashScreenDuration
has elapsed.no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetMachine(
) → void - Starts the sequence processing. If called again, it restarts from the beginning.
-
toString(
) → String -
A string representation of this object.
inherited
-
waitForComplete(
) → Future< void> - Waits until the process is completed.
-
waitForSplash(
) → Future< void> -
Waits until the time specified by
waitSplashScreenDuration
has elapsed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited