File tree 1 file changed +7
-10
lines changed
1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,14 @@ class ConnectionCubit extends Cubit<ConnectionState> {
75
75
onError: (String error) => emit (ConnectionErrorState (error)),
76
76
);
77
77
78
- _handleConnectionStatus (_api);
78
+ await _handleConnectionStatus (_api);
79
79
} on Exception catch (e) {
80
80
emit (ConnectionErrorState ('$e ' ));
81
81
}
82
82
}
83
83
84
- void _handleConnectionStatus (BaseAPI api) {
85
- _cancelConnectionStatusSubscription ();
84
+ Future < void > _handleConnectionStatus (BaseAPI api) async {
85
+ await _cancelConnectionStatusSubscription ();
86
86
87
87
_connectionStatusSubscription = api.connectionStatus.listen (
88
88
(APIStatus status) {
@@ -101,15 +101,12 @@ class ConnectionCubit extends Cubit<ConnectionState> {
101
101
);
102
102
}
103
103
104
- void _cancelConnectionStatusSubscription () {
105
- if (_connectionStatusSubscription != null ) {
106
- _connectionStatusSubscription! .cancel ();
107
- }
108
- }
104
+ Future <void > _cancelConnectionStatusSubscription () async =>
105
+ _connectionStatusSubscription? .cancel ();
109
106
110
107
@override
111
- Future <void > close () {
112
- _cancelConnectionStatusSubscription ();
108
+ Future <void > close () async {
109
+ await _cancelConnectionStatusSubscription ();
113
110
114
111
return super .close ();
115
112
}
You can’t perform that action at this time.
0 commit comments