Line data Source code
1 : import 'package:equatable/equatable.dart'; 2 : import 'package:hive_flutter/hive_flutter.dart'; 3 : import 'package:json_annotation/json_annotation.dart'; 4 : 5 : import '../local_storage.dart'; 6 : 7 : part 'chatwoot_user.g.dart'; 8 : 9 : /// 10 : @JsonSerializable(explicitToJson: true) 11 : @HiveType(typeId: CHATWOOT_USER_HIVE_TYPE_ID) 12 : class ChatwootUser extends Equatable { 13 : ///custom chatwoot user identifier 14 : @JsonKey() 15 : @HiveField(0) 16 : final String? identifier; 17 : 18 : ///custom user identifier hash 19 : @JsonKey() 20 : @HiveField(1) 21 : final String? identifierHash; 22 : 23 : ///name of chatwoot user 24 : @JsonKey() 25 : @HiveField(2) 26 : final String? name; 27 : 28 : ///email of chatwoot user 29 : @JsonKey() 30 : @HiveField(3) 31 : final String? email; 32 : 33 : ///profile picture url of user 34 : @JsonKey(name: "avatar_url") 35 : @HiveField(4) 36 : final String? avatarUrl; 37 : 38 : ///any other custom attributes to be linked to the user 39 : @JsonKey(name: "custom_attributes") 40 : @HiveField(5) 41 : final dynamic customAttributes; 42 : 43 6 : ChatwootUser( 44 : {this.identifier, 45 : this.identifierHash, 46 : this.name, 47 : this.email, 48 : this.avatarUrl, 49 : this.customAttributes}); 50 : 51 0 : @override 52 : List<Object?> get props => 53 0 : [identifier, identifierHash, name, email, avatarUrl, customAttributes]; 54 : 55 0 : factory ChatwootUser.fromJson(Map<String, dynamic> json) => 56 0 : _$ChatwootUserFromJson(json); 57 : 58 2 : Map<String, dynamic> toJson() => _$ChatwootUserToJson(this); 59 : }