ProfileService class

Singleton service for reading and updating UserProfiles.

Configure once before use:

ProfileService.instance.source = FirebaseProfileSource();

final profile = await ProfileService.instance.getProfile('user_123');
await ProfileService.instance.updateAvatar(
  userId: 'user_123',
  avatarUrl: 'https://cdn.example.com/avatars/user_123.jpg',
);

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source ProfileDataSource
The data source used by this service.
no getter

Methods

getProfile(String userId) Future<UserProfile?>
Returns the UserProfile for userId, or null if not found.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateAvatar({required String userId, required String avatarUrl}) Future<void>
Updates only the avatarUrl for userId.
updateProfile({required String userId, required Map<String, dynamic> updates}) Future<UserProfile>
Applies updates to the profile for userId and returns the result.
watchProfile(String userId) Stream<UserProfile?>
Returns a stream that emits the UserProfile whenever it changes.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance ProfileService
The global singleton instance.
no setter