I'm planning to visit my family in Sweden with a Schengen Visa. I'm from Indonesia in the city of Medan. There is no Swedish embassy or consulate nearby. The nearest is in Bali or Jakarta. There is a German consulate in my city that issues a Schengen visa. Since the Schengen visa allows me to travel to all the Schengen countries. Does it matter at which embassy/consulate I apply at?
Yes, it matters which embassy/consulate you apply to. The main rule to be aware of in cases like this, is that you must apply to the country that is the main destination of your trip.
If that country doesn't have a representation in a certain part of the world, they might have chosen to be nice to the people living in that part of the world, and made an agreement with another country that their representation can handle certain cases (an visa applications are often included in that) for them. But it's not your decision, but that of the country you want to visit.
In your case I would contact one of the Swedish embassies and ask if they have an agreement with Germany or any other Schengen country that has a representation closer to you, but don't go applying to the German consulate just because you feel like it, they should just reject your application for having been sent to the wrong place, but you're wasting your own (and their) time.
If the (normally) responsible consulate is not available, another Schengen consulate can be used in visa matters.
Since you must call to make an appointment anyway, mention the fact that your plan is primarily to visit Sweden.