I made a map switching widget based on the local layer widget that uses services and doesn't destroy the map (the widgets stay open) there are probably lots of examples out there for map switching widgets but this was a simple compact map switcher that uses radio buttons and doesn't take up a lot of map space.
It's based off the simple sample widget and doesn't have a config file.
Just replace the var baseURL with your rest service url location and the Radio List value and id.
The popup template just copy from the localLayer config file.
Main config