User class

Provides info about a user.

User has Altogic users model's default properties.

If you have custom properties in your users model, you can add or read them with "[]" and "[]=" operators.

E.g. If your user model has a property named age, you can read it with:

var age = user['age'];

Or you can add a property named age with:

user['age'] = 30;

Or you can crate a new User implementation with a property named age:

class MyUser extends User {
  MyUser(User user) : super.fromUser(user);

  int get age => this['age'] as int;

  set age(int value) => this['age'] = value;

}

For custom fields, implementing new User implementations is recommended.

Constructors

User(String id, {required String provider, required String providerUserId, required String lastLoginAt, required String signUpAt, String? password, String? name, String? profilePicture, Map<String, dynamic>? otherFields, String? email, String? phone})
Creates a instance of User
User.fromJson(Map<String, dynamic> json)
Creates a instance of User from JsonMap.
factory
User.fromUser(User user)
Using this constructor as super constructor you can create a custom User implementation instance from a User.

Properties

email String?
Users email address
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier of the user
getter/setter pair
lastLoginAt String
The last login date and time of the user. For each successful sign-in, this field is updated in the database.
getter/setter pair
name String?
The name of the user
getter/setter pair
password String?
Users password, valid only if Altogic is used as the authentication provider.
getter/setter pair
phone String?
Users phone number
getter/setter pair
profilePicture String?
Users password, valid only if Altogic is used as the authentication provider. Should be at least 6 characters long.
getter/setter pair
provider String
The authentication provider name, can be either Altogic, Google, Facebook, Twitter, Apple etc.
getter/setter pair
providerUserId String
The user id value that is retrieved from the provider after successful user authentication. The format of this field value can be different for each provider. If the provider is Altogic, providerUserId and _id values are the same.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signUpAt String
The sign up date and time of the user
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert instance to JsonMap.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) → dynamic
Get the value of a custom field.
operator []=(String key, dynamic value) → void
Set the value of a custom field.