Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while calling dispose() or cancel() on subscription #114

Open
mehtahardikr opened this issue Jul 26, 2023 · 1 comment
Open

Comments

@mehtahardikr
Copy link

var pubnub = PubNub(
  defaultKeyset:
      Keyset(subscribeKey: 'mySubscribeKey', publishKey: 'myPublishKey', uuid: UUID('uuid')));

var channel = "sample_channel";
var subscription = pubnub.subscribe(channels: {channel});

subscription.cancel();
or
await subscription.cancel();
or
await subscription.dispose();

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Future already completed
                                                                                                    #0      _AsyncCompleter.complete (dart:async/future_impl.dart:35:31)
                                                                                                    #1      Subscription.cancel (package:pubnub/src/subscribe/subscription.dart:176:22)
                                                                                                    <asynchronous suspension>
@mohitpubnub
Copy link
Contributor

Is it reproducible by the snippet you have shared? By running that code with my keyset I'm not seeing reported error.
However, I see that it's guarded operation by checking completion of mentioned promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants