streamVideoRequestById method

  1. @override
Stream<VideoRequestDetails?> streamVideoRequestById(
  1. String id
)
override

Implementation

@override
Stream<VideoRequestDetails?> streamVideoRequestById(String id) {
  try {
    return _streamVideoRequestByIdEventChannel
        .receiveBroadcastStream(id)
        .map<VideoRequestDetails?>((event) {
          if (event == null || event == '{}') {
            return null;
          }

          final jsonData = event is String
              ? jsonDecode(event) as Map<String, dynamic>
              : Map<String, dynamic>.from(event as Map);
          return VideoRequestDetails.fromJson(jsonData);
        })
        .asBroadcastStream();
  } on PlatformException {
    rethrow;
  }
}