I used https://www.drupal.org/project/issues/views_distinct → to solve that problem (filtering by NID). You'll need to patch it to get a D9/10 version though.
I created a view with flag as relationship. This causes nodes to appear more than once. I added distinct and also the only fields I added were Flag link and Flag count. Even though I removed the two fields with out removing the relationship, the rows are repeating how many time that particular node is flagged. If I flagged a node 3 time the node is appearing thrice.
Also "Node flag counter" relationship mentioned in the below link is not available in Drupal 8
https://www.drupal.org/node/922986 →
Needs work
Views integration
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I used https://www.drupal.org/project/issues/views_distinct → to solve that problem (filtering by NID). You'll need to patch it to get a D9/10 version though.