generateTimestampId static method
Generate a timestamp-based unique ID
Format: YYYYMMDD_HHMMSS (e.g., 20250114_153042) Useful for generating unique file names, request IDs, etc.
Implementation
static String generateTimestampId() {
final now = DateTime.now();
final year = now.year.toString();
final month = now.month.toString().padLeft(2, '0');
final day = now.day.toString().padLeft(2, '0');
final hour = now.hour.toString().padLeft(2, '0');
final minute = now.minute.toString().padLeft(2, '0');
final second = now.second.toString().padLeft(2, '0');
return '$year$month${day}_$hour$minute$second';
}