User class
A model representing a user in the system.
This class holds details about a user, including their ID, institution, role, phone number, FCM token, current location within a hospital, and various permission flags.
Constructors
- User.new({required int id, required String institutionId, required String role, required int roleId, required String phoneNumber, String? fcmToken, DateTime? fcmTokenUpdatedAt, String? currentBlockName, int? currentBlockId, int? currentWardID, String? currentWardName, int? floor, required int hospitalId, required bool isApprover, required bool isSuperuser, required bool isResponder, required bool isCreator})
- Creates a User instance.
-
User.fromJson(Map<
String, dynamic> json) -
Creates a User instance from a JSON map.
factory
Properties
- currentBlockId → int?
-
The ID of the block the user is currently associated with.
final
- currentBlockName → String?
-
The name of the block the user is currently associated with.
final
- currentWardID → int?
-
The ID of the ward the user is currently associated with.
final
- currentWardName → String?
-
The name of the ward the user is currently associated with.
final
- fcmToken → String?
-
The Firebase Cloud Messaging token for push notifications, if available.
final
- fcmTokenUpdatedAt → DateTime?
-
The timestamp when the FCM token was last updated.
final
- floor → int?
-
The floor the user is currently associated with.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hospitalId → int
-
The ID of the hospital the user belongs to.
final
- id → int
-
The unique identifier of the user.
final
- institutionId → String
-
The ID of the institution the user belongs to.
final
- isApprover → bool
-
A flag indicating if the user has approver permissions.
final
- isCreator → bool
-
A flag indicating if the user has creator permissions.
final
- isResponder → bool
-
A flag indicating if the user has responder permissions.
final
- isSuperuser → bool
-
A flag indicating if the user has superuser permissions.
final
- phoneNumber → String
-
The phone number of the user.
final
- role → String
-
The role of the user (e.g., 'admin', 'doctor', 'nurse').
final
- roleId → int
-
The ID corresponding to the user's role.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{int? id, String? institutionId, String? role, int? roleId, String? phoneNumber, String? fcmToken, DateTime? fcmTokenUpdatedAt, String? currentBlockName, int? currentBlockId, int? currentWardID, String? currentWardName, int? floor, int? hospitalId, bool? isApprover, bool? isSuperuser, bool? isResponder, bool? isCreator}) → User - Creates a copy of this User object with the given fields replaced with new values.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this User instance to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited