-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.dart
65 lines (51 loc) · 1.23 KB
/
main.dart
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(String, int) userInfo(Map<String, dynamic> json) {
return (json['name'] as String, json['height'] as int);
}
void parser(int charCode) {
const slash = 1;
const star = 2;
const plus = 3;
const minus = 4;
final nextCharCode = 'a';
const digit0 = 0;
const digit9 = 9;
void skipComment() {}
void operatorFn(int charCode) {}
void number() {}
void invalid() {}
switch (charCode) {
case slash when nextCharCode == slash:
skipComment();
case slash || star || plus || minus:
operatorFn(charCode);
case >= digit0 && <= digit9:
number();
default:
invalid();
}
}
const six = 6;
const msg = 'Feeling the Monday blues?';
String describeDate(DateTime dt) {
const one = 1;
return switch (dt.weekday) {
one => 'Feeling the Monday blues?',
7 || six => 'Enjoy the weekend!',
_ => 'Hang in there.'
};
}
void main() {
var (
String name,
int height,
) = userInfo({'name': 'Michael', 'height': 180});
print('User $name is $height cm tall.');
final json = {'name': 'Michael', 'height': 180};
if (json case {'name': 'Michael', 'height': int h}) {
print('Michael is $h cm tall.');
}
}
base class Foo {}
final class Bar {}
interface class Car {}
sealed class Zar {}