Replace `type_` with `type`

This commit is contained in:
krawieck 2020-08-11 19:54:12 +02:00
parent 4a096602b5
commit be3bd569f4
2 changed files with 4 additions and 3 deletions

View File

@ -10,14 +10,15 @@ part 'search.g.dart';
/// based on https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#search /// based on https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#search
@JsonSerializable(createToJson: false) @JsonSerializable(createToJson: false)
class Search { class Search {
final String type_; @JsonKey(name: "type_")
final String type;
final List<CommentView> comments; final List<CommentView> comments;
final List<PostView> posts; final List<PostView> posts;
final List<CommunityView> communities; final List<CommunityView> communities;
final List<UserView> users; final List<UserView> users;
const Search({ const Search({
this.type_, this.type,
this.comments, this.comments,
this.posts, this.posts,
this.communities, this.communities,

View File

@ -8,7 +8,7 @@ part of 'search.dart';
Search _$SearchFromJson(Map<String, dynamic> json) { Search _$SearchFromJson(Map<String, dynamic> json) {
return Search( return Search(
type_: json['type_'] as String, type: json['type_'] as String,
comments: (json['comments'] as List) comments: (json['comments'] as List)
?.map((e) => ?.map((e) =>
e == null ? null : CommentView.fromJson(e as Map<String, dynamic>)) e == null ? null : CommentView.fromJson(e as Map<String, dynamic>))