Line data Source code
1 : import 'package:equatable/equatable.dart'; 2 : import 'package:json_annotation/json_annotation.dart'; 3 : import 'package:stream_feed_dart/src/core/util/serializer.dart'; 4 : 5 : part 'user.g.dart'; 6 : 7 : /// 8 : @JsonSerializable() 9 : class User extends Equatable { 10 : /// 11 4 : const User({ 12 : this.id, 13 : this.data, 14 : this.createdAt, 15 : this.updatedAt, 16 : this.followersCount, 17 : this.followingCount, 18 : }); 19 : 20 : /// Create a new instance from a json 21 4 : factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json); 22 : 23 : /// 24 : final String? id; 25 : 26 : /// 27 : final Map<String, Object>? data; 28 : 29 : /// 30 : @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) 31 : final DateTime? createdAt; 32 : 33 : /// 34 : @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) 35 : final DateTime? updatedAt; 36 : 37 : /// 38 : @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) 39 : final int? followersCount; 40 : 41 : /// 42 : @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) 43 : final int? followingCount; 44 : 45 2 : @override 46 2 : List<Object?> get props => [ 47 2 : id, 48 2 : data, 49 2 : createdAt, 50 2 : updatedAt, 51 2 : followersCount, 52 2 : followingCount, 53 : ]; 54 : 55 : /// Serialize to json 56 2 : Map<String, dynamic> toJson() => _$UserToJson(this); 57 : }