Check if StreamSubscription is canceled

Issue

To put it simple:

How do i check if a StreamSubscription is canceled?

There is no

_myCustomSub.isCanceled

Solution

It seems you’d have to use one of two methods:

  1. onDone method – and retain in a seperate variable whether the stream was closed, or..
  2. cancel method – and await the future that signals that the StreamSubscription was canceled.

Don’t know of any other way.

Answered By – wildeyes

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *