2

As id is required while triggering the notification in flutter_local_notification package how can I make infinite no of IDs as I am making an alarm app and the number of alarms added depends on the user so how do I make ids in that case?

1 Answers1

0

I would personally use the uuid package to generate id's in this case:

http://pub.dartlang.org/packages/uuid

example

import 'package:uuid/uuid.dart';

// Create uuid object
var uuid = Uuid();

// Generate a v1 (time-based) id
uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'

// Generate a v4 (random) id
uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'

// Generate a v5 (namespace-name-sha1-based) id
uuid.v5(uuid.NAMESPACE_URL, 'www.google.com'); // -> 'c74a196f-f19d-5ea9-bffd-a2742432fc9c'
Marijn Berends
  • 203
  • 1
  • 7