fix: Null error in get own profile

On converting a User object to
a Profile object now leads to an
error. This fixes it.
This commit is contained in:
Krille Fear 2021-11-05 12:21:48 +01:00
parent 3ac1fcb1ff
commit 3e1aee6fcd
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,6 @@
## [0.7.0-nullsafety.3] - 05nd Nov 2021
- fix: Null error in get own profile
## [0.7.0-nullsafety.2] - 04nd Nov 2021 ## [0.7.0-nullsafety.2] - 04nd Nov 2021
- refactor: Make room in Event class not nullable - refactor: Make room in Event class not nullable
- refactor: download method should not return null - refactor: download method should not return null

View File

@ -609,9 +609,13 @@ class Client extends MatrixApi {
final profileSet = <Profile>{}; final profileSet = <Profile>{};
for (final room in rooms) { for (final room in rooms) {
final user = room.getUserByMXIDSync(userID!); final user = room.getUserByMXIDSync(userID!);
profileSet.add(Profile.fromJson(user.content)); profileSet.add(Profile(
avatarUrl: user.avatarUrl,
displayName: user.displayName,
userId: user.id,
));
} }
if (profileSet.length == 1) return profileSet.first; if (profileSet.length == 1) return profileSet.single;
} }
return getProfileFromUserId(userID!); return getProfileFromUserId(userID!);
} }

View File

@ -1,6 +1,6 @@
name: matrix name: matrix
description: Matrix Dart SDK description: Matrix Dart SDK
version: 0.7.0-nullsafety.2 version: 0.7.0-nullsafety.3
homepage: https://famedly.com homepage: https://famedly.com
environment: environment: