multicast method

ConnectableObservable<T> multicast({
  1. Subject<T>? subject,
  2. Map0<Subject<T>>? factory,
})

Returns an multicast observable that shares the underlying stream.

Implementation

ConnectableObservable<T> multicast(
    {Subject<T>? subject, Map0<Subject<T>>? factory}) {
  if (subject != null && factory != null) {
    throw ArgumentError.value(
        subject, 'subject', 'Subject and factory cannot both be given.');
  }
  factory ??= () => subject ?? Subject<T>();
  return MulticastObservable<T>(this, factory);
}