1 year ago

#376938

test-img

Ksenia Alexeeva

what is yield* controller.stream

what is the difference here first yield push our status to the stream and what does the second yield* do?

final _controller = StreamController<AuthenticationStatus>(); 
  Stream<AuthenticationStatus> get status async* {
    await Future<void>.delayed(const Duration(seconds: 1));
    yield AuthenticationStatus.unauthenticated;
    yield* _controller.stream;
    
  }

what would be the difference between yield AuthenticationStatus.unauthenticated; and _controller.add(AuthenticationStatus.unauthenticated)?

i can’t understand why we need to yield* controller.stream and what difference it makes

flutter

dart

stream

bloc

mobile-development

0 Answers

Your Answer

Accepted video resources