streamTicks method

  1. @override
Stream<Tick> streamTicks(
  1. List<String> interrupts, {
  2. Map<String, dynamic>? extra,
})
override

Stream digital interrupts ticks.

// Stream ticks from digital interrupts on pins 8 and 11
var interrupts = ['8', '11'];
Stream<Tick> tickStream = await myBoard.streamTicks(interrupts);

For more information, see Board component.

Implementation

@override
Stream<Tick> streamTicks(List<String> interrupts, {Map<String, dynamic>? extra}) {
  final response = client.streamTicks(StreamTicksRequest()
    ..name = name
    ..pinNames.addAll(interrupts)
    ..extra = extra?.toStruct() ?? Struct());

  final stream = response.map((resp) => Tick(pinName: resp.pinName, high: resp.high, time: resp.time));
  return stream.asBroadcastStream(onCancel: (_) => response.cancel());
}