diff --git a/lib/src/event.dart b/lib/src/event.dart index 154f090..45f9d03 100644 --- a/lib/src/event.dart +++ b/lib/src/event.dart @@ -93,9 +93,7 @@ class Event extends MatrixEvent { // into the unsigned block this.prevContent = prevContent != null && prevContent.isNotEmpty ? prevContent - : (unsigned != null && - unsigned.containsKey('prev_content') && - unsigned['prev_content'] is Map + : (unsigned != null && unsigned['prev_content'] is Map ? unsigned['prev_content'] : null); this.stateKey = stateKey; @@ -483,8 +481,7 @@ class Event extends MatrixEvent { final targetName = stateKeyUser.calcDisplayname(); // Has the membership changed? final newMembership = content['membership'] ?? ''; - final oldMembership = unsigned.containsKey('prev_content') && - unsigned['prev_content'] is Map + final oldMembership = unsigned != null && unsigned['prev_content'] is Map ? unsigned['prev_content']['membership'] ?? '' : ''; if (newMembership != oldMembership) { @@ -521,14 +518,12 @@ class Event extends MatrixEvent { } } else if (newMembership == 'join') { final newAvatar = content['avatar_url'] ?? ''; - final oldAvatar = unsigned.containsKey('prev_content') && - unsigned['prev_content'] is Map + final oldAvatar = unsigned != null && unsigned['prev_content'] is Map ? unsigned['prev_content']['avatar_url'] ?? '' : ''; final newDisplayname = content['displayname'] ?? ''; - final oldDisplayname = unsigned.containsKey('prev_content') && - unsigned['prev_content'] is Map + final oldDisplayname = unsigned != null && unsigned['prev_content'] is Map ? unsigned['prev_content']['displayname'] ?? '' : '';