import 'package:json_annotation/json_annotation.dart'; part 'attach_file_model.g.dart'; @JsonSerializable(explicitToJson: true) class AttachFileModel { AttachFileModel({ this.title = '', this.url = '', this.type = '', }); factory AttachFileModel.fromJson(Map json) => _$AttachFileModelFromJson(json); @JsonKey(name: 'title', includeIfNull: true, defaultValue: '') String title; @JsonKey(name: 'url', includeIfNull: true, defaultValue: '') String url; @JsonKey(name: 'type', includeIfNull: true, defaultValue: '') String type; static const fromJsonFactory = _$AttachFileModelFromJson; static const toJsonFactory = _$AttachFileModelToJson; Map toJson() => _$AttachFileModelToJson(this); }