From 2e3d8205b1faa7907179301c8fab7c91667225b0 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 30 Jun 2020 12:21:03 +0200 Subject: [PATCH] analyze and format --- lib/src/client.dart | 10 ++++------ lib/src/room.dart | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 7448ade..d431b33 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1432,12 +1432,10 @@ class Client { void _addUpdate() { // we only want max. one update per 50ms - if (_updateTimer == null) { - _updateTimer = Timer(Duration(milliseconds: 50), () { - onUpdate.add(true); - _updateTimer = null; - }); - } + _updateTimer ??= Timer(Duration(milliseconds: 50), () { + onUpdate.add(true); + _updateTimer = null; + }); } bool _disposed = false; diff --git a/lib/src/room.dart b/lib/src/room.dart index 2f92ade..10ec758 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -106,7 +106,8 @@ class Room { if (!partial || client.database == null) { return; } - final allStates = await client.database.getAllRoomStatesForRoom(client.id, id).get(); + final allStates = + await client.database.getAllRoomStatesForRoom(client.id, id).get(); for (final state in allStates) { final newState = Event.fromDb(state, this); setState(newState);