refactor: await unconditionally

This commit is contained in:
Lukas Lihotzki 2021-04-16 14:19:42 +02:00
parent ffef732103
commit 71fdd28a8a
1 changed files with 2 additions and 14 deletions

View File

@ -1100,13 +1100,7 @@ class Room {
); );
if (states != null) { if (states != null) {
var rawStates; for (final rawState in await states) {
if (states is Future) {
rawStates = await states;
} else {
rawStates = states;
}
for (final rawState in rawStates) {
final newState = Event.fromDb(rawState, newRoom); final newState = Event.fromDb(rawState, newRoom);
newRoom.setState(newState); newRoom.setState(newState);
} }
@ -1114,13 +1108,7 @@ class Room {
final newRoomAccountData = <String, BasicRoomEvent>{}; final newRoomAccountData = <String, BasicRoomEvent>{};
if (roomAccountData != null) { if (roomAccountData != null) {
var rawRoomAccountData; for (final singleAccountData in await roomAccountData) {
if (roomAccountData is Future) {
rawRoomAccountData = await roomAccountData;
} else {
rawRoomAccountData = roomAccountData;
}
for (final singleAccountData in rawRoomAccountData) {
final content = Event.getMapFromPayload(singleAccountData.content); final content = Event.getMapFromPayload(singleAccountData.content);
final newData = BasicRoomEvent( final newData = BasicRoomEvent(
content: content, content: content,