250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Leetcode
- Equatable
- Extentsion
- keyWindow
- reetcode
- IOS
- GIT
- algorithm
- xcode
- tip
- pubspec
- COMMIT
- swiftlint
- github
- Swift
- ToDoRim
- listview
- flutter
- OSLog
- enumerations
- toyproject
- dart
- it
- Widget
- UIAccessibility
- SwiftGen
- pubspec.yaml
- designPattern
- protocol
- basic
Archives
- Today
- Total
수니의 개발새발
[Flutter/Dart] final 과 const 본문
728x90
반응형
final / const
- 둘 다 상수를 선언하는 키워드
- final은 프로그램이 실행될 때(런타임 시점에) 값을 초기화
- ex) final
final DateTime now = new DateTime.now(); // final 은 런타임시점에 결정되는 값도 설정할 수 있다.
print(now); // 2022-02-15 21:55:42.462
- const는 컴파일 시점에 값을 초기화
- ex) const
const DateTime now = new DateTime.now(); // ERROR
// const는 런타임시점에 결정되는 값을 설정할 수 없다.
DateTime.now()
런타임 시점에 현재 시각을 구하는 함수
🙋🏻♀️ 참고
728x90
반응형
'Flutter' 카테고리의 다른 글
[Flutter/Widget] Column, Row (MainAxisAlignment) (0) | 2022.02.24 |
---|---|
[Flutter/Widget] Scaffold, Container, BoxDecoration, AppBar (0) | 2022.02.23 |
[Flutter/Widget] Text, SafeArea (Debug 배너 해제) (0) | 2022.02.13 |
[Flutter/Widget] Spacer, Padding, Image, Expanded, SizedBox (0) | 2022.02.13 |
[Mac/AndroidStudio/Flutter] 단축키 모음 (0) | 2022.02.13 |
Comments