Change tab with code

My current app has 3 tabs, the first (List) and the last one (Map) share a detailed Page.

Which will be the code to move from the detailed view to Map Page? I’m currently using nav.setRoot(X) but that code is only working when I’m in the detailed view with Map as parent Page, if tap on the item to switch to the Map page from the List -> Detail Page I get the following error:


Any advice?

I’m in a pushed view, how do I return to a root tab page?


Imagine that I have an app with 2 tabs, how can I move from tab A to tab B with code instead of tapping on the tabbar?