generateUniqueId method

String generateUniqueId({
  1. required String? type,
})

Produces a runtime-only element id when card JSON omits id.

Implementation

String generateUniqueId({required String? type}) {
  final newId = (type == null)
      ? UniqueKey().toString()
      : '$type-${UniqueKey()}';
  assert(() {
    developer.log(
      'Generating Unique ID: $newId for type $type',
      //stackTrace: StackTrace.current,
    );
    return true;
  }());
  return newId;
}