Skip to content

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Cannot add event after closing #41

@nitishabraham20

Description

@nitishabraham20

Getting the above exception in the following scenario -

Connected to a stream having multiple events, after receiving first event, created another connection having a single event, once the event is received ideally we should receive the pending event from the first stream, however getting this exception and not receiving the pending event.

Below is the code -
EventFlux.instance.connect(EventFluxConnectionType.post, ,
header: header,
body: body,
onSuccessCallback: (EventFluxResponse? response) {
response?.stream?.listen(
(data) {
}
);
},
autoReconnect: true,
reconnectConfig: ReconnectConfig(
mode: ReconnectMode.linear,
reconnectHeader: () async {
if (_lastEventId != null) {
header['Last-Event-ID'] = _lastEventId!;
}
return header;
},
onReconnect: () {
},
),
onConnectionClose: () {
},
onError: (error) {
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions