Advertisement
Guest User

Untitled

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