Sometimes in our social circles we see things naturally and allow our feelings to flow. That isnt so healthy as you've found out.
Firstly- your relationship with her ended. She is free to do as she pleases. I know that you know that but when it ends you should be pleased for her to move on and find love. It is a case of thinking about your friendship first and putting your own inner sadness in second place.
She could be flirting with this guy because-
- She believes your relationship with her ended
- She might not realise you are still sensitive about it
- She might not have realised you were close by
- She might know you still hold onto feelings and she flirted as a means to tell you its over
- other reasons
See us humans act in strange ways sometimes. Best not to jump to conclusions. It also best to talk face to face as friends, ask her directly how she feels about you if there is a chance to get back together...better to find out and face to pain that assume things that arent there.
Finally, sometimes people break things off and give reasons that arent accurate. Like "I'm scared" when the real reason is she didnt want it to continue.
You might feel you are not good enough and for her maybe so, that doesnt mean you arent suitable for someone more ideal and compatible.
There's someone for everyone, hard part is finding that person.