User constructor

User({
  1. required String name,
  2. required String email,
  3. String? password,
})

Creates a new user instance.

When password is provided, it is hashed before being stored on the model.

Example:

final user = User(
  name: 'Jane Doe',
  email: 'jane@example.com',
  password: 'secret123',
);

Implementation

User({required this.name, required this.email, String? password})
  : password = password != null ? Hasher.make(key: password) : null,
    super.fromJson({});