setServicesUserListener static method

Future setServicesUserListener(
  1. void onData(
    1. dynamic event
    )?
)

Implementation

static Future setServicesUserListener(void onData(dynamic event)?) async {
  if(onData != null) {
    if(servicesUserSubscription != null) {
      servicesUserSubscription!.cancel();
      servicesUserSubscription = null;
    }
    servicesUserSubscription = _servicesUserEventChannel.receiveBroadcastStream().listen(onData);
  }
  else {
    if(servicesUserSubscription != null) {
      servicesUserSubscription!.cancel();
      servicesUserSubscription = null;
    }
  }
}