MessageTranslationInfo.fromMap constructor

MessageTranslationInfo.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory MessageTranslationInfo.fromMap(Map<String, dynamic> map) {
  return MessageTranslationInfo(
    targetLanguage: map['targetLanguage'] as String? ?? '',
    sourceLanguage: map['sourceLanguage'] as String?,
    text: map['text'] as String? ?? '',
    translatedAt: map['translatedAt'] is int
        ? map['translatedAt'] as int
        : int.tryParse('${map['translatedAt']}') ?? 0,
    source: map['source'] == MessageTranslationSource.auto.name
        ? MessageTranslationSource.auto
        : MessageTranslationSource.manual,
    hidden: map['hidden'] == true,
  );
}