agenda.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:get/get.dart';
  2. import 'package:json_annotation/json_annotation.dart';
  3. part 'agenda.g.dart';
  4. @JsonSerializable()
  5. class Agenda {
  6. @JsonKey(name: 'id', fromJson: _intToString, toJson: _stringToInt)
  7. String id;
  8. @JsonKey(name: 'talkId')
  9. String talkId;
  10. @JsonKey(name: 'name')
  11. String? name;
  12. @JsonKey(name: 'content')
  13. String? content;
  14. @JsonKey(name: 'createTime')
  15. String? createTime;
  16. @JsonKey(name: 'updateTime')
  17. String? updateTime;
  18. @JsonKey(ignore: true)
  19. RxBool todo = false.obs;
  20. @JsonKey(name: 'example')
  21. bool? isExample;
  22. bool? isDone;
  23. Agenda(
  24. {required this.id,
  25. required this.talkId,
  26. this.name,
  27. this.content,
  28. this.createTime,
  29. this.updateTime,
  30. this.isExample});
  31. factory Agenda.fromJson(Map<String, dynamic> json) {
  32. final agenda = _$AgendaFromJson(json);
  33. agenda.todo.value =
  34. json.containsKey('todo') ? json['todo'] as bool? ?? false : false;
  35. return agenda;
  36. }
  37. static String _intToString(int value) => value.toString();
  38. static int _stringToInt(String value) => int.parse(value);
  39. }