Decadent chocolate stimulates your taste buds, and the caffeine and theobromine in this treat stimulate your heart rate in a way that could prevent you from falling asleep. There's nothing wrong with indulging in a piece of chocolate after dinner, but try to take your last bite well before bedtime.
Not all types of chocolate are equal in terms of the amounts of caffeine they contain. According to The New York Times, a dark chocolate Hershey’s candy bar has about 30 milligrams of caffeine (same as a cup of instant tea) and a milk chocolate bar has 9 milligrams. White chocolate is the safest bet before bed, as it doesn't have any theobromine and barely has any caffeine. If you have love for dark chocolate, like I do, consider checking the clock before reaching for a piece.