My suggestion is simple: allow barrels to store flour.
Say that one unit of flour is equal to a liter worth of capacity used. Using a unit of flour on a barrel fills it as normal, and averages out the quality of the flour inside, like other 'liquids' do. Rightclicking withdraws a unit of flour. Pretty simple, I think.
It'd allow much more storage of flour, and far simpler trading with it (would anyone even buy 100 units of flour?). Averaging the values would probably balance out the advantages of having no bad flour, with losing out on having the good flour. You would still need to add and remove single units at a time, so it shouldn't be super efficient. Better capacity than a cupboard, but slower.
That's about it!