refactor: await unconditionally
This commit is contained in:
parent
ffef732103
commit
71fdd28a8a
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue