-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathmain.2.dart
40 lines (32 loc) · 1.13 KB
/
main.2.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
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';
var value = "before";
Future<void> main() async {
// Declare an unreferenced lazy static field.
Expect.equals(0, hotReloadGeneration);
await hotReload();
// The lazy static field changes value but remains unread.
Expect.equals(1, hotReloadGeneration);
await hotReload();
// The lazy static is now read and contains the updated value.
print(value);
Expect.equals(2, hotReloadGeneration);
Expect.equals("before", value);
await hotReload();
// The lazy static is updated and read but retains the old value.
Expect.equals(3, hotReloadGeneration);
Expect.equals("before", value);
}
/** DIFF **/
/*
@@ -17,6 +17,7 @@
await hotReload();
// The lazy static is now read and contains the updated value.
+ print(value);
Expect.equals(2, hotReloadGeneration);
Expect.equals("before", value);
await hotReload();
*/