til

newDay4 (stream)

paulaner80 2022. 6. 23. 12:22
반응형

 

Stream

 

Stream.castFrom(source)
Stream.empty();
Stream.error(error);
Stream.eventTransformed(source, (sink) => null)
Stream.fromFuture(future)
Stream.fromFutures(futures)
Stream.fromIterable(elements)
Stream.multi((p0) { })
Stream.periodic(period)
Stream.value(value)

 

 

9. periodic

computation이 있어야합니다. 없으면 null이 나옵니다.

void main(){
  //Stream<int>
  var computation = (x)=> x;
   var stream = Stream.periodic(const Duration(seconds: 1), computation).take(10);

  stream.listen(print);

}

'til' 카테고리의 다른 글

new Day3 (The default value of an optional parameter must be constant)  (0) 2022.06.21
new Day3 (위젯 사이에 공간을 주는 방법들)  (0) 2022.06.13
new Day2 (BottomNavigationBar 사용법)  (0) 2022.06.10
new Day 1  (0) 2022.06.09
day26  (0) 2022.01.18