'Flutter - How to implement News Count on a flutter app

I'm trying to implement a visitor-counter on a app built entirely with flutter and I'm trying to accomplish this with nothing but plain dart code and some packages from pub.dev.

But the problem which has been bugging me is that I need to find a way to uniquely identify users based on their devices so that I don't end up incrementing the counter for the same person again and again upon a revisit.

I want to increment the counter on users visiting the news.

So far what I've thought is that I could use firestore for keeping track of the total number of visitors and display the same on the my app with an eye icon.

Is there any better approach to this problem? Any help would be appreciated 😁

If there is any solution please provide an example code in flutter of how to implement this

It would of great help.

(ps: I have no prior flutter experience)



Solution 1:[1]

I have an idea unique users can be identified by the imei number

use this plugin to the imei number https://pub.dartlang.org/packages/imei_plugin

based on imei number you can keep track of the visitors.

Solution 2:[2]

You can use UDID, have a package to do this https://pub.dev/packages/flutter_udid

The logical is simple, save the UDID in cloud storage and in each new visitor verify if match to the UDID local

Of course if you have to optimize it, but the raw is this

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SWAG Assassin YT
Solution 2 efe