Open mehtahardikr opened 1 year ago
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();
subscription.cancel();
await subscription.cancel();
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>
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.
subscription.cancel();
orawait subscription.cancel();
orawait subscription.dispose();