A Flow, such as one created via flow() is welcome to call suspend functions. Those functions are welcome to switch the context to use a different dispatcher, perhaps moving long-running work off to Dispatchers.Default or Dispatchers.IO.

However, you cannot use withContext() within the flow() lambda expression directly. That leads to a compile error.

You can learn more about this in:
Run Edit