getDurationName property

String get getDurationName

Convert date to today / tomorrow / yesterday

Implementation

String get getDurationName {
  final now = DateTime.now();
  final differ = difference(now).inDays;
  switch (differ) {
    case 0:
      return "Today";
    case 1:
      return "Tomorrow";
    case -1:
      return "Yesterday";
    default:
      return toFormattedString();
  }
}