Flow of energy in an ecosystem is always:

Sun is the ultimate source of energy in an ecosystem. Energy always flows from sun to the producer through photosynthesis. From producers energy transfers to different consumers. It always flow from sun to producer and then to consumers.

2