toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  final ret = super.toJson();
  ret['message'] = message;
  ret['target_langs'] = translationTargetLanguages;
  if (translationTargetLanguages.isNotEmpty) {
    ret['translations'] = {for (var e in translationTargetLanguages) e: ''};
  }
  ret['poll_id'] = pollId;
  ret['extended_message'] = extendedMessage;

  ret.removeWhere((key, value) => value == null);
  return ret;
}