return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>android - What to expect when using CombineLatestStream with throttle for streams with different frequencies? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - What to expect when using CombineLatestStream with throttle for streams with different frequencies? - Stack Overflow

programmeradmin0浏览0评论

Im trying to combine 3 streams

  1. accelerometer stream from sensors_plus
  2. orientation stream from flutter_rotation_sensor
  3. location stream from geolocator

Im using CombineLatestStream from rxdart to combine these streams and what I understand is that when either of the 3 emit a new value, the combined stream will emit a new value.

This was fine but I then added throttleTime() to the stream, now what I understand is that the first value emitted by the combined stream during the window will be taken and everything after that will be ignored until the next window.

Im confused about the behaviour when: say stream 1, stream 2, stream 3 emit [A1, B1, C1] respectively now this is emitted by the combined stream and the throttling begins, during this time stream 1 being faster emits again and so the values are [A2, B1, C1]. The process repeats and stream 1 happens to emit first again(A3), will the latest values of stream 2 and stream 3 be considered or will the same stale values(B1, C1) keep getting emitted if stream 1 happens to be faster to emit in each throttling window?

  CombineLatestStream.list([
    accelerometerEventStream(
        samplingPeriod: SensorInterval.fastestInterval), // Stream 0
    frs.RotationSensor.orientationStream, // Stream 1
    getLocationUpdates(), // Stream 2
  ])
      .throttleTime(const Duration(milliseconds: 18))
      .listen((data) {
    // data[i] corresponds to the ith stream
    final accEvent = data[0] as AccelerometerEvent;
    final frsEvent = data[1] as frs.OrientationEvent;
    final locEvent = data[2] as Position;
    final now = DateTime.now();

    // code to necessary perform operations on the data

  });

I expect the latest data from each of the streams to be emitted every 20ms. I couldn't find a clear explaination of this behaviour, any help or alternative approach will be appreciated, thank you.

发布评论

评论列表(0)

  1. 暂无评论