createUser static method
Creates a new user and stores it in the database.
Implementation
static Future<UserInfo?> createUser(
Session session,
UserInfo userInfo, [
String? authMethod,
]) async {
if (AuthConfig.current.onUserWillBeCreated != null) {
var approved = await AuthConfig.current.onUserWillBeCreated!(
session,
userInfo,
authMethod,
);
if (!approved) return null;
}
await session.db.insert(userInfo);
if (userInfo.id != null) {
if (AuthConfig.current.onUserCreated != null) {
await AuthConfig.current.onUserCreated!(session, userInfo);
}
return userInfo;
}
return null;
}