KingWu/flutter_starter_kit

doesn't this seem more complex than needed?

dyardyGIT opened this issue · 1 comments

Just working through your approach and finding things a little layered. I had to document it out to figure out the layered approach. Does this sound right?

Main

creates AppStoreApplication object (creating instances of DbAppStoreRepository, AppStoreAPIRepository, and Router)

creates new AppComponent stateful widget (passing in AppStoreApplication object)
> which returns AppProvider (inherited widget)
- which passes in application and surfaces Router, AppStoreApplication

interesting approach (just seems little complex) no?

For my approach,
AppStoreApplication holds all model instance like DB, API provider. And also, handle application's initialization and destroy.

Normally, i can define a global instance of this AppStoreApplication though singleton. But, i would like to follow Flutter structure, which each widget can access the AppStoreApplication instance.

So that, i build a AppProvider (inherited widget). Then each widget can access the AppStoreApplication instance.