Melt the butter and olive oil in a large saute pan over medium-low heat. Add onions and stir to coat. Cook for 20 minutes, stirring occasionally.
Sprinkle the salt and sugar over the onions and continue to cook for another 30 minutes to 1 hour, stirring occasionally. You're looking for a deep, rich brown color. They may start to stick to the pan a little. If they do, hit them with a little bit of water or vinegar. It's OK if they form a bit of a crust, but don't let them burn. Set aside to cool.
To make the flatbread:
Preheat oven to 425 degrees.
Place flatbread on a pizza stone or baking sheet. Use a pastry brush to brush flatbread with olive oil and sprinkle with a bit of salt. Top flatbread with caramelized onions and crumbled goat cheese. Bake for 6-10 minutes, depending on the thickness of your bread. (The cheese should start to melt and the edges of the bread should start to brown.)
Remove from oven and sprinkle with basil. Cut into pieces and serve.
Additional cooking time listed is for caramelizing the onions.Adapted from thekitchn.com.