How to generate a Unique id, flutter


I am making a todo app with notifications and am using flutter local notifications plugin, How do I generate a unique integer as id for a specific todo so that I can also cancel notification of that specific todo using that unique integer.


You can use UniqueKey().hashCode() to get a unique int.
For example:

final notificationId = UniqueKey().hashCode()
// or you can use

Answered By – DarShan

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *