It's more of a sliding scale with the independent variable being how old you are, and how long you've been developing. When you're younger or just getting started in development, you should definitely cast a wide net. As you get older, and depending also on whether you develop as a hobby or professionally, you might want to narrow your focus, shifting your gaze every now and then just to avoid tunnel vision.
The end game of this whole process is essentially to get develop a final product or solve a problem, so the scope of the product or problem is also a factor. Can you ramp up in languages / frameworks fast enough to solve a bunch of separate problems for a disparate variety of customers? Then perhaps being a polyglot and freelancer is for you. Are you trying to solve a single large problem or build a large product? Then maybe focus on just a handful of cohesive technologies.
The benefit of the latter approach is that if you can master a single technology well enough, then you could potentially gain one of those "passive income streams" I often hear people talk about, where you've built a thing and the thing can continue to pay off long after you've built it simply by bringing in / bringing back customers over time, and all you need to do afterwards is maintenance and minor updates while focusing on other projects.