File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 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> {
7575 onError: (String error) => emit (ConnectionErrorState (error)),
7676 );
7777
78- _handleConnectionStatus (_api);
78+ await _handleConnectionStatus (_api);
7979 } on Exception catch (e) {
8080 emit (ConnectionErrorState ('$e ' ));
8181 }
8282 }
8383
84- void _handleConnectionStatus (BaseAPI api) {
85- _cancelConnectionStatusSubscription ();
84+ Future < void > _handleConnectionStatus (BaseAPI api) async {
85+ await _cancelConnectionStatusSubscription ();
8686
8787 _connectionStatusSubscription = api.connectionStatus.listen (
8888 (APIStatus status) {
@@ -101,15 +101,12 @@ class ConnectionCubit extends Cubit<ConnectionState> {
101101 );
102102 }
103103
104- void _cancelConnectionStatusSubscription () {
105- if (_connectionStatusSubscription != null ) {
106- _connectionStatusSubscription! .cancel ();
107- }
108- }
104+ Future <void > _cancelConnectionStatusSubscription () async =>
105+ _connectionStatusSubscription? .cancel ();
109106
110107 @override
111- Future <void > close () {
112- _cancelConnectionStatusSubscription ();
108+ Future <void > close () async {
109+ await _cancelConnectionStatusSubscription ();
113110
114111 return super .close ();
115112 }
You can’t perform that action at this time.
0 commit comments