From dddc9a23c6870b4012888f73d323d0ae0c39723c Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 2 Sep 2019 10:33:32 +0200 Subject: [PATCH] [TypeDef] Place all typedefs on the top --- lib/src/Client.dart | 6 +++--- lib/src/Connection.dart | 4 ++-- lib/src/RoomList.dart | 8 ++++---- lib/src/Timeline.dart | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/src/Client.dart b/lib/src/Client.dart index 0cafa73..305538e 100644 --- a/lib/src/Client.dart +++ b/lib/src/Client.dart @@ -37,6 +37,9 @@ import 'requests/SetPushersRequest.dart'; import 'responses/ErrorResponse.dart'; import 'responses/PushrulesResponse.dart'; +typedef AccountDataEventCB = void Function(AccountData accountData); +typedef PresenceCB = void Function(Presence presence); + /// Represents a Matrix client to communicate with a /// [Matrix](https://matrix.org) homeserver and is the entry point for this /// SDK. @@ -338,6 +341,3 @@ class Client { return resp; } } - -typedef AccountDataEventCB = void Function(AccountData accountData); -typedef PresenceCB = void Function(Presence presence); diff --git a/lib/src/Connection.dart b/lib/src/Connection.dart index 3253c21..b781939 100644 --- a/lib/src/Connection.dart +++ b/lib/src/Connection.dart @@ -473,6 +473,8 @@ class Connection { } } +typedef _FutureVoidCallback = Future Function(); + class _LifecycleEventHandler extends WidgetsBindingObserver { _LifecycleEventHandler({this.resumeCallBack, this.suspendingCallBack}); @@ -494,6 +496,4 @@ class _LifecycleEventHandler extends WidgetsBindingObserver { } } -typedef _FutureVoidCallback = Future Function(); - enum LoginState { logged, loggedOut } diff --git a/lib/src/RoomList.dart b/lib/src/RoomList.dart index 9d97607..a26819b 100644 --- a/lib/src/RoomList.dart +++ b/lib/src/RoomList.dart @@ -32,6 +32,10 @@ import 'User.dart'; import 'sync/EventUpdate.dart'; import 'sync/RoomUpdate.dart'; +typedef onRoomListUpdateCallback = void Function(); +typedef onRoomListInsertCallback = void Function(int insertID); +typedef onRoomListRemoveCallback = void Function(int insertID); + /// Represents a list of rooms for this client, which will automatically update /// itself and call the [onUpdate], [onInsert] and [onDelete] callbacks. To get /// the initial room list, use the store or create a RoomList instance by using @@ -167,7 +171,3 @@ class RoomList { if (onUpdate != null) onUpdate(); } } - -typedef onRoomListUpdateCallback = void Function(); -typedef onRoomListInsertCallback = void Function(int insertID); -typedef onRoomListRemoveCallback = void Function(int insertID); diff --git a/lib/src/Timeline.dart b/lib/src/Timeline.dart index 36e4907..aeb89df 100644 --- a/lib/src/Timeline.dart +++ b/lib/src/Timeline.dart @@ -28,6 +28,9 @@ import 'Room.dart'; import 'User.dart'; import 'sync/EventUpdate.dart'; +typedef onTimelineUpdateCallback = void Function(); +typedef onTimelineInsertCallback = void Function(int insertID); + /// Represents the timeline of a room. The callbacks [onUpdate], [onDelete], /// [onInsert] and [onResort] will be triggered automatically. The initial /// event list will be retreived when created by the [room.getTimeline] method. @@ -102,6 +105,3 @@ class Timeline { if (onUpdate != null) onUpdate(); } } - -typedef onTimelineUpdateCallback = void Function(); -typedef onTimelineInsertCallback = void Function(int insertID);