@@ -28,15 +28,16 @@ void staticFunction(int formal) {
28
28
}
29
29
30
30
void staticAsyncFunction (String value) async {
31
- var myLocal = await 'a local value' ;
31
+ // ignore: unused_local_variable
32
+ final myLocal = await 'a local value' ;
32
33
print (value); // Breakpoint: staticAsyncFunction
33
34
}
34
35
35
36
void staticAsyncLoopFunction (String value) async {
36
37
Function ? f;
37
38
for (var i in [1 , 2 , 3 ]) {
38
39
print (i);
39
- var myLocal = await 'my local value' ;
40
+ final myLocal = await 'my local value' ;
40
41
f ?? = () {
41
42
print (value);
42
43
print (i);
@@ -48,9 +49,9 @@ void staticAsyncLoopFunction(String value) async {
48
49
49
50
void main () async {
50
51
print ('Initial print from scopes app' );
51
- var local = 'local in main' ;
52
- var intLocalInMain = 42 ;
53
- var testClass = MyTestClass ();
52
+ final local = 'local in main' ;
53
+ final intLocalInMain = 42 ;
54
+ final testClass = MyTestClass ();
54
55
Object ? localThatsNull;
55
56
identityMap['a' ] = 1 ;
56
57
identityMap['b' ] = 2 ;
@@ -59,7 +60,7 @@ void main() async {
59
60
notAList.add (7 );
60
61
61
62
String nestedFunction <T >(T parameter, Object aClass) {
62
- var another = int .tryParse ('$parameter ' );
63
+ final another = int .tryParse ('$parameter ' );
63
64
return '$local : parameter, $another ' ; // Breakpoint: nestedFunction
64
65
}
65
66
@@ -68,7 +69,7 @@ void main() async {
68
69
}
69
70
70
71
Timer .periodic (const Duration (seconds: 1 ), (Timer t) {
71
- var ticks = t.tick;
72
+ final ticks = t.tick;
72
73
// ignore: unused_local_variable, prefer_typing_uninitialized_variables
73
74
var closureLocal;
74
75
libraryPublicFinal.printCount ();
@@ -79,12 +80,12 @@ void main() async {
79
80
print (nestedFunction ('$ticks ${testClass .message }' , Timer ));
80
81
print (localThatsNull);
81
82
print (libraryNull);
82
- var localList = libraryPublic;
83
+ final localList = libraryPublic;
83
84
print (localList);
84
85
localList.add ('abc' );
85
- var f = testClass.methodWithVariables ();
86
+ final f = testClass.methodWithVariables ();
86
87
print (f ('parameter' ));
87
- var num = '1234' .someExtensionMethod ();
88
+ final num = '1234' .someExtensionMethod ();
88
89
print ('$num ' );
89
90
});
90
91
@@ -96,7 +97,7 @@ void main() async {
96
97
97
98
String libraryFunction (String arg) {
98
99
print ('calling a library function with $arg ' );
99
- var concat = 'some constant plus $arg plus whatever' ;
100
+ final concat = 'some constant plus $arg plus whatever' ;
100
101
print (concat);
101
102
return concat;
102
103
}
@@ -118,11 +119,11 @@ class MyTestClass<T> extends MyAbstractClass {
118
119
String hello () => message;
119
120
120
121
String Function (String ) methodWithVariables () {
121
- var local = '$message + something' ;
122
+ final local = '$message + something' ;
122
123
print (local);
123
124
return (String parameter) {
124
125
// Be sure to use a field from this, so it isn't entirely optimized away.
125
- var closureLocalInsideMethod = '$message /$local /$parameter ' ;
126
+ final closureLocalInsideMethod = '$message /$local /$parameter ' ;
126
127
print (closureLocalInsideMethod);
127
128
return closureLocalInsideMethod; // Breakpoint: nestedClosure
128
129
};
@@ -184,7 +185,7 @@ class NotReallyAList extends ListBase<Object?> {
184
185
185
186
extension NumberParsing on String {
186
187
int someExtensionMethod () {
187
- var ret = int .parse (this );
188
+ final ret = int .parse (this );
188
189
return ret; // Breakpoint: extension
189
190
}
190
191
}
0 commit comments