티스토리 뷰

#1/Flutter

[flutter] Cascade notation

_쿠나 2021. 9. 14. 16:04
728x90

..

 

바로바로 객체의 정보에 접근 가능하다.

 

공식 문서: Cascades(.., ?..) 는 같은 객체의 operation을 연속으로 허락하게 한다. 

함수를 호출하면 같은 object의 field에도 접근할 수 있다. 

일시적인 변수를 생성할 때나 좀더 fluid 한 코드를 만들고자 할 때 유용하다.

 

var paint = Paint()
	..color = Colors.black
    ..strokeCap = StrokeCap.round
    ..strokeWidth = 5.0;

 

 

https://dart.dev/guides/language/language-tour#cascade-notation

 

A tour of the Dart language

A tour of all the major Dart language features.

dart.dev

 

728x90
댓글
250x250
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함