getCurrentDate function

String getCurrentDate({
  1. String? newDateTimeFormat,
})

getCurrentDate method this method will get current date in format provided.

Implementation

String getCurrentDate({String? newDateTimeFormat}) {
  if (newDateTimeFormat != null && newDateTimeFormat.isNotEmpty) {
    return DateFormat(newDateTimeFormat).format(DateTime.now());
  } else {
    return DateFormat(kDefaultDateTimeFormat).format(DateTime.now());
  }
}