toTypingTime property

String get toTypingTime

Returns typing indicator timestamp

Implementation

String get toTypingTime {
  final now = DateTime.now();
  final localTime = toLocal();
  final difference = now.difference(localTime);

  if (difference.inSeconds < 10) {
    return 'typing now';
  } else if (difference.inMinutes < 1) {
    return 'typing ${difference.inSeconds}s ago';
  } else {
    return 'last seen $toChatTime';
  }
}