The main purpose of flux in soldering is to

prevent oxidation and lower the melting range of the solder

dissolve surface oxides and prevent further oxidation

prevent recrystallization and grain growth

dissolve surface oxides and lower the melting range