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