import 'Driver.dart'; import 'FileModel.dart'; class users { int? id; String? username; String? email; String? name; String? gender; String? phoneNumber; String? country; String? city; String? provider; bool? active; bool? verified; String? address; bool? deleted; bool? blocked; String? role; String? blockReason; FileModel? image; Driver? driver; bool? notificationFcm; bool? notificationEmail; int? timestamp; users({ this.id, this.username, this.email, this.name, this.gender, this.phoneNumber, this.country, this.city, this.provider, this.active, this.verified, this.blocked, this.address, this.deleted, this.role, this.image, this.driver, this.blockReason, this.notificationFcm, this.notificationEmail, this.timestamp, }); factory users.fromJson(Map json) { return users( id: json['id'], username: json['username'], email: json['email'], name: json['name'], gender: json['gender'], phoneNumber: json['phonenumber'], country: json['country'], city: json['city'], provider: json['provider'], active: json['active']??false, verified: json['verified']??false, blocked: json['blocked']??false, address: json['address'], deleted: json['deleted'], blockReason: json['blockReason'], role: json['role'], driver: json['driver'] != null && json['driver'] is Map ? Driver.fromJson(json['driver'] as Map) : null, image: json['image']!= null ? FileModel.fromJson(json['image']) : null, notificationFcm: json['notificationfcm'], notificationEmail: json['notificationemail'], timestamp: json['timestmp'], ); } Map toJson() { return { 'id': id, 'username': username, 'email': email, 'name': name, 'gender': gender, 'phonenumber': phoneNumber, 'country': country, 'city': city, 'provider': provider, 'active': active, 'verified': verified, 'address': address, 'deleted': deleted, 'role': role, 'blockReason': blockReason, 'blocked': blocked, 'notificationfcm': notificationFcm, 'notificationemail': notificationEmail, 'timestmp': timestamp, }; } // Override equality operator @override bool operator ==(Object other) { if (identical(this, other)) return true; return other is users && other.id == id; // Compare based on id or another unique property } // Override hashCode @override int get hashCode => id.hashCode; @override String toString() { return 'users{id: $id, username: $username, email: $email, name: $name, gender: $gender, phoneNumber: $phoneNumber, country: $country, city: $city, provider: $provider, active: $active, address: $address, deleted: $deleted, blocked: $blocked, role: $role, blockReason: $blockReason, image: $image, driver: $driver, notificationFcm: $notificationFcm, notificationEmail: $notificationEmail, verified: $verified, timestamp: $timestamp}'; } }