flutter_rounded_loading_button icon indicating copy to clipboard operation
flutter_rounded_loading_button copied to clipboard

Unhandled Exception: Bad state: Cannot add new events after calling close

Open Abdullahfoysal opened this issue 4 years ago • 2 comments

My code: _btnController.start(); var logoutData = await HttpService().logOut(api, body); if (logoutData != null) { _btnController.stop(); Navigator.of(context) .pushNamedAndRemoveUntil(LoginScreen.routeName, (route) => false); }

errors:
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: Bad state: Cannot add new events after calling close #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24) #1 Subject._add (package:rxdart/src/subjects/subject.dart:141:17) #2 Subject.add (package:rxdart/src/subjects/subject.dart:135:5) #3 _StreamSinkWrapper.add (package:rxdart/src/subjects/subject.dart:167:13) #4 RoundedLoadingButtonState._reset (package:rounded_loading_button/rounded_loading_button.dart:305:17)

Abdullahfoysal avatar Sep 21 '21 06:09 Abdullahfoysal

I'm having the same problem.

luis-cruzt avatar Oct 11 '21 15:10 luis-cruzt

You would get this error if one of the controller action methods is called after the widget is removed from the stack. My guess in the example would be that the stop() call is probably unnecessary as the widget is removed in the next line.

chrisedg87 avatar Oct 11 '21 20:10 chrisedg87