currentUserProfile function
The signed-in user's own profile, from the replica.
Answers straight away from what the device holds, offline included, and waits for the first sync on a device that holds nothing yet.
Implementation
@riverpod
Stream<Profile> currentUserProfile(Ref ref) async* {
final replica = await ref.watch(accountReplicaProvider.future);
if (replica == null) return;
await for (final profile in replica.watchProfile()) {
if (profile != null) yield profile;
}
}