1
0
Fork 0
forked from Nexus/nexus

more elegantly handle empty displaynames

This commit is contained in:
Henry Hiles 2026-05-31 21:46:22 -04:00
commit eb87cbc17b
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 30 additions and 18 deletions

View file

@ -231,10 +231,10 @@ class ClientController extends AsyncNotifier<int> {
Future<Paginate> paginate(PaginateRequest request) async =>
Paginate.fromJson(await _sendCommand("paginate", request.toJson()));
Future<Profile> getProfile(String userId) async => Profile.fromJsonWithCatch({
...(await _sendCommand("get_profile", {"user_id": userId})),
"id": userId,
});
Future<Profile> getProfile(String userId) async {
final json = await _sendCommand("get_profile", {"user_id": userId});
return Profile.fromJsonWithCatch({...json, "id": userId});
}
Future<void> reportEvent(ReportRequest request) =>
_sendCommand("report_event", request.toJson());

View file

@ -12,8 +12,6 @@ class ProfileController extends AsyncNotifier<Profile> {
return client.getProfile(userId);
}
static final provider =
AsyncNotifierProvider.family<ProfileController, Profile, String>(
ProfileController.new,
);
static final provider = AsyncNotifierProvider.family
.autoDispose<ProfileController, Profile, String>(ProfileController.new);
}