Have Sans and Flowey fought before?

Solution 1:

Unmarked spoilers ahead (since spoiler warnings are included in the question).

It seems like, reading this sentence, that Sans already fought and beat Flowey many times in the past. But, during the whole game, it doesn't seems like Sans has ever met Flowey at all.

Both these statements are true. Flowey has the ability to Save and Load.

After acquiring this ability, Flowey first tried to help the denizens of the Underground but got bored and began messing with and killing them. The resets he mentioned were caused by him being discovered by and defeated by Sans.

Sans is aware something keeps reseting the timeline but, unlike Flowey, cannot Save and does not keep memories of other timelines. He doesn't know of Flowey's identity (or perhaps even his existence) in any timeline in-game.