Skip to content

Conversation

@hfjxjjd123
Copy link

No description provided.

HakRimLee added 2 commits October 17, 2022 15:59
@iju1633 iju1633 added the 🙋‍♂️🙋‍♀️ 리뷰 요청 PR 리뷰를 요청합니다~ label Oct 19, 2022
@iju1633 iju1633 changed the title 모바일팀 이학림 블로그 PR 10월 모바일팀 이학림 블로그 PR Oct 19, 2022
@iju1633 iju1633 self-requested a review October 19, 2022 05:56
@iju1633 iju1633 requested a review from hoqn October 26, 2022 10:26
}
```

일반적으로 `Stream` 객체의 데이터에 접근하는 과정에서 iterator의 개념이 사용되는데, 가장 최근에 올라온 이벤트들을 하나씩 처리하고 지워나가면서 `Stream` 안에 남은이벤트가 없어질 때 까지 이를 계속하게 된다.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

남은이벤트 -> 남은 이벤트 수정 부탁드립니다!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
```
`Stream`으로 정의된 함수는 선언 즉시 `Stream` 객체를 반환하며, 그 후엔 `Stream`의 데이터에 접근해 사용할 때까지 아무 일도 일어나지 않는다.
이후 <strong>`listen()`</strong>/<strong>`await for`</strong> 키워드를 통해 `Stream`객체의 데이터에 접근할 수 있으며, 이 때 `async*` 함수가 동작하게 된다.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async* 함수에서 *는 의도된 표현인가요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네! dart에서 async/async* future/stream 타입 종류에 따라구분되어 사용되고 있습니다.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

블로그글 내용 수정해서 명시하겠습니다

@iju1633 iju1633 added the 🔨 수정 요청 리뷰 과정 중 수정 사항이 생겼을 때 label Oct 26, 2022
@iju1633
Copy link

iju1633 commented Oct 26, 2022

데일리 스크럼 시간에 동기/비동기 이야기를 좀 나눴었는데, 글로도 남겨주셔서 감사하고 예시를 들어주시니 이해가 더 쉽게 되네요!

@iju1633 iju1633 removed the 🙋‍♂️🙋‍♀️ 리뷰 요청 PR 리뷰를 요청합니다~ label Oct 26, 2022
<br>

이 때, `snapshot.hasData`라는 필드에 접근해서 비동기처리의 상태를 알아낼 수 있다.
`true` => 외부로부터 결과값 or Error값을 받아온 상태

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사소하지만 true와 false 부분을 줄바꿈으로 가독성을 높이는 건 어떠실까요?
보기에도 더 예쁠거 같습니다 ㅎㅎ !

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 감사합니다

void main() async{

Future<String> getString1(){
return Future.delayed(Duration(seconds:1),()=>"연산1");
Copy link

@simpack0513 simpack0513 Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future 타입은 반환할 때 Future<String>으로 명시를 해주지 않아도 상관없나요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future을 명시해주지 않아도 var 타입처럼 런타임중 자동으로 타입이 결정되어 실행되는 것 같습니다(var과 매커니즘이 똑같은지는 잘 모르겠습니다). 하지만 Future가 복잡하게 사용되는 상황에서 Future을 명시해주지 않으면 원하지 않는 타입을 반환해서 오류가 발생하는 일이 있을 수 있습니다!

Copy link
Author

@hfjxjjd123 hfjxjjd123 Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 aysnc 함수의 반환형을 물으신 거라면.. 명시해주지 않아도 됩니다. 정확히는 async 키워드는함수의 body내에서 future형을 다룬다는 것을 의미하므로 async 함수자체의 반환형이 future일 필요는 없습니다. 이 내용도 추가하겠습니다!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전자의 상황이었지만 var처럼 사용된다니 역시 좋은 언어인거 같습니다 ㅎㅎ

@simpack0513
Copy link

Future 타입만 다뤄보았는데 Stream도 이해할 수 있어서 좋았습니다 ㅎㅎ 정리를 잘해주셔서 종종 까먹을 때 와서 보기 좋아요!

@iju1633 iju1633 added the ✅ 리뷰 완료 한 명 이상이 리뷰를 완료했을 때 label Oct 28, 2022
paulben0410
paulben0410 previously approved these changes Oct 28, 2022
@SSUHYUNKIM
Copy link

학림

  1. 학림님 대표 이미지 넣어주시면 자동으로 위에 올라가서 이미지 삽입하신 부분 지우시면 될 것 같습니다.
  2. 맞춤법이 맞지 않는 부분들이 있어서 수정해주시면 감사하겠습니다.
    학림 - MD 문법 문제
  3. markdown 문법 문제로 띄어쓰기나 특정부분이 어색한 곳들이 있습니다. 다른 분들 글 참고하시고 수정해주시면 될 것 같습니다.

@hfjxjjd123
Copy link
Author

1,2,3 수정해봤습니다~!

@SSUHYUNKIM SSUHYUNKIM added 🛠 수정 완료 수정 요청 사항이 모두 해결됐을 때 and removed ✅ 리뷰 완료 한 명 이상이 리뷰를 완료했을 때 🔨 수정 요청 리뷰 과정 중 수정 사항이 생겼을 때 labels Nov 10, 2022
@SSUHYUNKIM SSUHYUNKIM added the 🙋‍♂️🙋‍♀️ 리뷰 요청 PR 리뷰를 요청합니다~ label Nov 10, 2022
@SSUHYUNKIM SSUHYUNKIM added 💯 최종 완료 모든 수정과 리뷰가 끝난 후 merge를 기다릴 때 and removed 🛠 수정 완료 수정 요청 사항이 모두 해결됐을 때 🙋‍♂️🙋‍♀️ 리뷰 요청 PR 리뷰를 요청합니다~ labels Nov 10, 2022
@SSUHYUNKIM SSUHYUNKIM self-requested a review November 10, 2022 13:41
@SSUHYUNKIM SSUHYUNKIM merged commit d6eab01 into GDSC-University-of-Seoul:master Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💯 최종 완료 모든 수정과 리뷰가 끝난 후 merge를 기다릴 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants