import 'package:get/get.dart'; import 'package:json_annotation/json_annotation.dart'; part 'agenda.g.dart'; @JsonSerializable() class Agenda { @JsonKey(name: 'id', fromJson: _intToString, toJson: _stringToInt) String id; @JsonKey(name: 'talkId') String talkId; @JsonKey(name: 'name') String? name; @JsonKey(name: 'content') String? content; @JsonKey(name: 'createTime') String? createTime; @JsonKey(name: 'updateTime') String? updateTime; @JsonKey(ignore: true) RxBool todo = false.obs; @JsonKey(name: 'example') bool? isExample; bool? isDone; Agenda( {required this.id, required this.talkId, this.name, this.content, this.createTime, this.updateTime, this.isExample}); factory Agenda.fromJson(Map json) { final agenda = _$AgendaFromJson(json); agenda.todo.value = json.containsKey('todo') ? json['todo'] as bool? ?? false : false; return agenda; } static String _intToString(int value) => value.toString(); static int _stringToInt(String value) => int.parse(value); }