the solution in your referenced link is about expanding the flag property of a message when you are using a filter to get the messages, not filtering messages using the flag property. For example, in your case, you will get 10 messages in the response and each message may or may not have the 'SingleValueExtendedProperties' property, here is the rule:
if(message.SingleValueExtendedProperties == undefined){
console.log(email has not been flagged/unflagged)
}else if(message.SingleValueExtendedProperties[0].Value == 2){
console.log('email is flagged')
}else if(message.SingleValueExtendedProperties[0].Value == 1){
console.log('email has been unflagged')
}
Back to your question about filtering using flag property, I have not seen any api call for that, but I will update my answer if I find any.