@@ -36,14 +36,14 @@ void main() {
36
36
_verifySampleFile (result, 'library' );
37
37
} else if (Platform .isAndroid) {
38
38
final Future <Directory ?> result = getLibraryDirectory ();
39
- expect (result, throwsA (isInstanceOf <UnsupportedError >()));
39
+ await expectLater (result, throwsA (isInstanceOf <UnsupportedError >()));
40
40
}
41
41
});
42
42
43
43
testWidgets ('getExternalStorageDirectory' , (WidgetTester tester) async {
44
44
if (Platform .isIOS) {
45
45
final Future <Directory ?> result = getExternalStorageDirectory ();
46
- expect (result, throwsA (isInstanceOf <UnsupportedError >()));
46
+ await expectLater (result, throwsA (isInstanceOf <UnsupportedError >()));
47
47
} else if (Platform .isAndroid) {
48
48
final Directory ? result = await getExternalStorageDirectory ();
49
49
_verifySampleFile (result, 'externalStorage' );
@@ -53,7 +53,7 @@ void main() {
53
53
testWidgets ('getExternalCacheDirectories' , (WidgetTester tester) async {
54
54
if (Platform .isIOS) {
55
55
final Future <List <Directory >?> result = getExternalCacheDirectories ();
56
- expect (result, throwsA (isInstanceOf <UnsupportedError >()));
56
+ await expectLater (result, throwsA (isInstanceOf <UnsupportedError >()));
57
57
} else if (Platform .isAndroid) {
58
58
final List <Directory >? directories = await getExternalCacheDirectories ();
59
59
expect (directories, isNotNull);
@@ -79,7 +79,7 @@ void main() {
79
79
(WidgetTester tester) async {
80
80
if (Platform .isIOS) {
81
81
final Future <List <Directory >?> result = getExternalStorageDirectories ();
82
- expect (result, throwsA (isInstanceOf <UnsupportedError >()));
82
+ await expectLater (result, throwsA (isInstanceOf <UnsupportedError >()));
83
83
} else if (Platform .isAndroid) {
84
84
final List <Directory >? directories =
85
85
await getExternalStorageDirectories (type: type);
@@ -92,17 +92,12 @@ void main() {
92
92
}
93
93
94
94
testWidgets ('getDownloadsDirectory' , (WidgetTester tester) async {
95
- if (Platform .isAndroid) {
96
- final Future <Directory ?> result = getDownloadsDirectory ();
97
- expect (result, throwsA (isInstanceOf <UnsupportedError >()));
98
- } else {
99
- final Directory ? result = await getDownloadsDirectory ();
100
- // On recent versions of macOS, actually using the downloads directory
101
- // requires a user prompt (so will fail on CI), and on some platforms the
102
- // directory may not exist. Instead of verifying that it exists, just
103
- // check that it returned a path.
104
- expect (result? .path, isNotEmpty);
105
- }
95
+ final Directory ? result = await getDownloadsDirectory ();
96
+ // On recent versions of macOS, actually using the downloads directory
97
+ // requires a user prompt (so will fail on CI), and on some platforms the
98
+ // directory may not exist. Instead of verifying that it exists, just
99
+ // check that it returned a path.
100
+ expect (result? .path, isNotEmpty);
106
101
});
107
102
}
108
103
0 commit comments