Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.85 KB | None | 0 0
  1. // Importing Json package
  2. library app_entry;
  3. import 'package:json_annotation/json_annotation.dart';
  4. part 'app_entry.g.dart';
  5.  
  6. //annotation for the code generator to know that this class needs the
  7. // JSON serialization logic to be generated.
  8.   @JsonSerializable
  9.   class AppEntry extends Object with _$AppEntrySerializerMixin(){
  10.    
  11.     @JsonKey(nullable: true)
  12.     final String name;
  13.  
  14.     @JsonKey(nullable: true)
  15.     final String imgUrl;
  16.  
  17.     @JsonKey(nullable: true)
  18.     final String marketUrl;
  19.  
  20.     //@JsonKey(includeIfNull: true)
  21.     @JsonKey(nullable: true)
  22.     final String summary;
  23.  
  24.     AppEntry(this.name, this.imgUrl, this.marketUrl, this.summary);
  25.  
  26.    factory AppEntry.fromJson(Map<String, dynamic> json) => _$AppEntrySerializableFromJson(json);
  27.  
  28.    Map<String, dynamic> toJson() => _$AppEntrySerializableToJson(this);
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement