It really depends on the style, but it's actually sort of the opposite..."sweet" beer would usually imply that there are residual sugars that have not yet been turned into alcohol, ergo fermentation is not complete. The "flat beer" taste is actually more of what you're going for...then you can add your priming sugar and bottle. If you bottle an overly sweet beer, then it's likely to overcarbonate, simply because the yeast keeps working after you bottle it. You want to bottle your beer when it has completed fermentation, so when you add priming sugar and bottle, you're essentially adding more sugars for the yeast to eat, which produces CO2 as a byproduct, which is trapped in the bottle, which ultimately dissolves into your beer in a controlled fashion [because the priming sugar has been carefully measured out].