The flow of energy and materials through the biotic and abiotic components of an ecosystem. It includes many processes such as biomass production, trophic transfer through plants and animals, nutrient cycling, water dynamics and heat transfer.