accessOnEventContext method
Provides access the full AFPublicState, which can be accessed in a UI event handler, but not as part of your actual build logic.
Note that the build logic should only reference data in your route parameter and state view, because your UI only re-builds when data in those objects changes.
However, in an event handler, like that for a button press, you can and should be able to access any data in the entire AFib state. This call lets you do so, while clarifying that it should not be used as part of your build logic.
There are parallel versions in the finish query context and in the context within your default theme
and LPIs, for easy-of-use with shared functions that expect an AFOnEventContext
.
Note that when defining a screen prototype, you can use the navigateWithEventContext parameter, rather than navigate, to gain access to an eventContext and pass it to a navigatePush function, or other shared function.
Implementation
AFOnEventContext accessOnEventContext() {
return AFBuildOnEventContext(
dispatcher: dispatcher,
buildContext: this
);
}