createUser method
Implementation
Future<User> createUser({
String? userId,
String? username,
String? email,
String? image,
String? password,
dynamic metadata,
}) async {
HeraRequest req = HeraRequest();
User user = User();
user.id = userId ?? "";
user.username = username ?? "";
user.email = email ?? "";
user.image = image ?? "";
user.password = password ?? "";
req.cloudToken = await _authorize.getAccessToken();
req.user = user;
req.namespace = namespace;
if (metadata != null) {
String encodeMetadata = jsonEncode(metadata);
user.metadata = encodeMetadata;
}
try {
HeraResponse resp = await grpcUserClient.createUser(req);
return resp.user;
} catch (e) {
if (debug == true) {
print("could not create user with err: " + e.toString());
}
rethrow;
}
}