Open Abdullahfoysal opened 3 years ago
I'm having the same problem.
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.
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)