Skip to main content

User profiles

Update your profile

Use NCEngine.user.updateMyUserProfile() to modify the current user's profile.

UserProfile properties

PropertyTypeDescription
nameStringNickname (max 32 characters)
portraitUriStringAvatar URL (max 128 characters)
uniqueIdStringUser app ID (read-only from SDK)
emailStringEmail (max 128 characters)
birthdayStringBirthday (max 32 characters)
genderUserGenderGender: unknown (0), male (1), female (2)
locationStringLocation (max 32 characters)
roleintRole (0–100)
levelintLevel (0–100)
userExtProfileMapCustom extension (max 10 keys)
Dart
final profile = UserProfile(name: 'Tom', portraitUri: 'https://example.com/avatar.png');
await NCEngine.user.updateMyUserProfile(profile, (error) {
if (error == null) print('Profile updated');
});

Get user profiles (batch)

Query up to 20 users per call.

Dart
await NCEngine.user.getUserProfiles(['user1', 'user2'], (profiles, error) {
if (error == null && profiles != null) {
print('Profiles: $profiles');
}
});

Get current user profile

Dart
await NCEngine.user.getMyUserProfile((profile, error) {
if (error == null) print('My profile: $profile');
});

Manage profile visibility

EnumDescription
notSetInherit App Key setting
invisibleHidden from all (except name and avatar)
everyoneVisible to all
friendVisibleVisible to friends only

Set visibility

Dart
await NCEngine.user.updateMyUserProfileVisibility(
UserProfileVisibility.everyone,
(error) {
if (error == null) print('Visibility updated');
},
);

Get visibility

Dart
await NCEngine.user.getMyUserProfileVisibility((int? visibility, NCError? error) {
if (error == null) print('Visibility: $visibility');
});

Search by user ID

info

Searching a public profile by uniqueId is not currently exposed in the Flutter SDK wrapper. Use getUserProfiles() when you already know the target user IDs.

Subscribe to profile changes

Use SubscribeType.userProfile to subscribe to user profile and visibility changes for up to 200 users (1000 total).

Dart
final params = SubscribeEventParams(
subscribeType: SubscribeType.userProfile,
expiry: 180000,
userIds: ['user1', 'user2'],
);
await NCEngine.user.subscribeEvent(params, (failedUserIds, error) {
if (error == null) print('Subscribed to profile updates');
});

Listen for profile changes

Dart
NCEngine.addUserHandler('profile-handler', UserHandler(
onSubscribeEvent: (subscribeEvents) {
print('Profile changes: $subscribeEvents');
},
onSubscriptionSyncCompleted: (type) {
print('Sync completed for type: $type');
},
));