cancelWhenScanComplete static method

void cancelWhenScanComplete(
  1. StreamSubscription subscription
)

Register a subscription to be canceled when scanning is complete. This function simplifies cleanup, so you can prevent creating duplicate stream subscriptions.

  • this is an optional convenience function
  • prevents accidentally creating duplicate subscriptions before each scan

Implementation

static void cancelWhenScanComplete(StreamSubscription subscription) {
  FlutterBluePlus._scanSubscriptions.add(subscription);
}