Getting error while calling dispose() or cancel() on subscription
mehtahardikr opened this issue · 1 comments
mehtahardikr commented
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 commented
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.