Energy flow in an ecosystem refers to the transfer of energy from one organism to another through food chains and food webs. The primary source of energy in an ecosystem is the sun, which is captured by plants through photosynthesis. This energy is then passed on to herbivores, carnivores, and decomposers as they consume each other.