The main purpose of flux in soldering is to

dissolve surface oxides and prevent further oxidation.

prevent recrystallization and grain growth.

prevent oxidation and lower the melting range of the solder

dissolve surface oxides and lower the melting range.