setUser method
Implementation
Future<QAccount> setUser({
required String userId,
required String userKey,
String? username,
String? avatarUrl,
Json? extras,
}) async {
if (userId.isEmpty) {
throw ArgumentError.value(
userId,
'userId',
'userId should not be empty string',
);
}
if (userKey.isEmpty) {
throw ArgumentError.value(
userKey,
'userKey',
'userKey should not be empty string',
);
}
return setUserImpl(
userId: userId,
userKey: userKey,
displayName: username,
avatarUrl: avatarUrl,
extras: extras,
)
.run(_dio)
.map((state) {
var data = state.run(_storage);
_storage = data.second;
return data.first;
})
.runOrThrow()
.tap((_) => _connectMqtt());
}