How to work with view subcontainers in Flow

376 Views Asked by At

what is the intended way to tackle subcontainer navigation with Flow on Android.

Let's say I have a couple of Screens where one works like a container screen itself - there I want to do some subnavigation (changing part of this screen).

I guess the Screen should serve as a temporal Flow.Dispatcher and proxy all Flow commands. How to do that? By calling Flow.setDispatcher I effectively replace the parent dispatcher, which is not intended. I guess creating a new Flow instance is not welcomed either, that should be an app wide singleton..?

1

There are 1 best solutions below

2
On

This is the kind of scenario that https://github.com/square/flow/tree/master/flow-path was made for.

Life is best if you have a single app-wide instance of flow. We've tried it the other way, where a higher level flow has a screen that happens to be a container for a nested flow, and life gets pretty complicated pretty quickly.