반응형
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 |
Tags
- Android
- list
- 데스크셋업
- 라이언
- AppleSilicon
- visualstudiocode
- database
- GetX
- M1
- sqflite
- swift
- 플러터
- listview
- xcode
- 내돈내산
- 간단리뷰
- TextField
- error
- ios
- Flutter
- wrap
- 데스크테리어
- react
- 춘식
- 카카오
- AppBar
- GitHub
- VSCode
- datetime
- Git
Archives
- Today
- Total
welcome to my blog
[Flutter][dart] 랜덤Random / List<Map> 사용 본문
728x90
dart 랜덤 수 사용
import 'dart:math';
var randomIndex = Random().nextInt(10);
0~10 까지의 수 중에서 랜덤 수 반환
nextInt 내부의 수를 바꿔서 사용
List<Map> 정의 / 사용
List<Map> weekArray = [
{'name': 'monday', 'text': '월요일'},
{'name': 'tuesday', 'text': '화요일'},
{'name': 'wednesday', 'text': '수요일'},
{'name': 'thursday', 'text': '목요일'},
{'name': 'friday', 'text': '금요일'},
{'name': 'saturday', 'text': '토요일'},
{'name': 'sunday', 'text': '일요일'},
];
weekArray[0]['name']; //monday
weekArray[1]['name']; //tuesday
weekArray[2]['name']; //wednesday
weekArray[3]['name']; //thursday
weekArray[4]['name']; //friday
weekArray[5]['text']; //saturday
weekArray[6]['text']; //sunday
weekArray[0]['text']; //월요일
weekArray[1]['text']; //화요일
weekArray[2]['text']; //수요일
weekArray[3]['text']; //목요일
weekArray[4]['text']; //금요일
weekArray[5]['text']; //토요일
weekArray[6]['text']; //일요일
728x90
반응형
'Flutter' 카테고리의 다른 글
[Flutter]CocoaPods not installed. Skipping pod install. (0) | 2021.11.02 |
---|---|
[Flutter] ToDo List 정리 (0) | 2021.10.27 |
[Flutter] Error - Could not run build/ios/iphonesos/Runner.app on (0) | 2021.10.25 |
[Flutter] BottomNavigation (0) | 2021.10.21 |
[Flutter] getX Counter App With GetX (0) | 2021.10.20 |