User class

The User class of Gun used for authentification.

You need a Gun instance to get the associated instance of User.

final user = gun.user();

then you can use it to authenticate a user:

user.auth('username', 'password');

Properties

hashCode int
The hash code for this object.
no setterinherited
info UserInfo?
Returns the information about the user. If the user is not connected, it returns null.
no setter
keys KeyPair?
Returns the public Keys of the user. If the user is not connected, it returns null.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

auth(String username, String password) Future<KeyPair?>
Returns properties (public/private keys) of the logged user. If the auth failed, returns null.
authWithKeyPair(KeyPair pair) Future<KeyPair?>
Returns properties (public/private keys) of the logged user. If the auth failed, returns null.
create(String username, String password) Future<String?>
Creates a new user with the username and password provided. Returns the public key of the user.
delete(String username, String password) Future<bool>
Delete the user.
get(String sub) User
Returns the information present on the sub node.
leave() User
Disconnect the user.
map() User
Iterate on each property of a node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off() User
Unsubscribe from changes.
on(dynamic cb(dynamic data, String key)) User
Apply the callback function to each change of the document.
once(dynamic cb(dynamic data, String key)) User
Apply the callback function once without subscribing to changes.
pair() KeyPair?
Returns the key pair of the user.
put(dynamic data) User
Integrates data (string or object) in a node and saves them to the User, synchronizing the peers of a network.
recall() User
Use the local storage to save the user.
set(dynamic data) User
Adds a unique data object to a node.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited