1

I am building a quiz app using Flutter and relying on provider to update the UI. My widget tree has two main branches. One that relates to menu and the other game loop.

Currently I am using a Multiprovider for the screens/branch that pertain to the game loop. I would prefer to avoid using provider at MaterialApp level (ie very top of widget tree). However I am having error messages on some consumers of the game loop. I assume that scope could be the source of the issue.

Is there any widget that could encapsulate my game loop (consisting of multiple screens/scaffolds) below material app? Or another way to wrap between Scaffold and MaterialApp while using provider?

Alexandre Jean
  • 622
  • 2
  • 11
  • 19
  • 1
    This is a bit of a non-answer, so I'll comment. I would say do not fear "global" state when it will simply solve your problem. If you trust yourself not to break the app, just go for it. – Michael Lee Dec 09 '20 at 04:38
  • 1
    Thanks Michael - indeed this is one of my worries. The other one is performance. Being an early flutter adopter but also still a rookie, I ended up with more imports than I wanted. Sigh – Alexandre Jean Dec 09 '20 at 04:46

0 Answers0