I'm not sure how feasible this is given the current architecture. As David Morgan said, we use this global variable app all over the place, so in some sense anywhere it's used essentially the whole project is being imported. But maybe it's possible to use packages to officially declare that the view depends on the model but not the other way around, for instance. Similarly the reducers depend on the model but not the other way around, and there's no dependence between the view and reducers.
Most of the usages of the global app variable are:
Calling app.dispatch to dispatch an action. This is done through app because it stores the Redux stores.
Unfortunately, these both in some sense seem to preclude splitting up the app variable into other smaller global variables. The first is needed to access the Redux stores, one of which stores the entire current AppState, and the second also requires accessing the current AppState, also through the main store.
See https://github.com/google/built_value.dart/issues/1304
I'm not sure how feasible this is given the current architecture. As David Morgan said, we use this global variable app all over the place, so in some sense anywhere it's used essentially the whole project is being imported. But maybe it's possible to use packages to officially declare that the view depends on the model but not the other way around, for instance. Similarly the reducers depend on the model but not the other way around, and there's no dependence between the view and reducers.
Most of the usages of the global
app
variable are:app.dispatch
to dispatch an action. This is done throughapp
because it stores the Redux stores.AppState
. This is typically done in code in view files, but not in React render methods, in keeping with the principle I explained here: https://stackoverflow.com/questions/62942644/how-to-make-a-react-component-intelligently-dispatch-a-redux-action-on-user-inte.Unfortunately, these both in some sense seem to preclude splitting up the
app
variable into other smaller global variables. The first is needed to access the Redux stores, one of which stores the entire currentAppState
, and the second also requires accessing the currentAppState
, also through the main store.