2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- // @dart = 2.9
6
-
7
5
import 'dart:async' ;
8
6
import 'dart:convert' ;
9
7
import 'dart:io' ;
@@ -36,7 +34,7 @@ void main() {
36
34
),
37
35
);
38
36
final WebViewController controller = await controllerCompleter.future;
39
- final String currentUrl = await controller.currentUrl ();
37
+ final String ? currentUrl = await controller.currentUrl ();
40
38
expect (currentUrl, 'https://flutter.dev/' );
41
39
});
42
40
@@ -57,7 +55,7 @@ void main() {
57
55
);
58
56
final WebViewController controller = await controllerCompleter.future;
59
57
await controller.loadUrl ('https://www.google.com/' );
60
- final String currentUrl = await controller.currentUrl ();
58
+ final String ? currentUrl = await controller.currentUrl ();
61
59
expect (currentUrl, 'https://www.google.com/' );
62
60
});
63
61
@@ -91,7 +89,7 @@ void main() {
91
89
};
92
90
await controller.loadUrl ('https://flutter-header-echo.herokuapp.com/' ,
93
91
headers: headers);
94
- final String currentUrl = await controller.currentUrl ();
92
+ final String ? currentUrl = await controller.currentUrl ();
95
93
expect (currentUrl, 'https://flutter-header-echo.herokuapp.com/' );
96
94
97
95
await pageStarts.stream.firstWhere ((String url) => url == currentUrl);
@@ -328,7 +326,7 @@ void main() {
328
326
});
329
327
330
328
group ('Video playback policy' , () {
331
- String videoTestBase64;
329
+ late String videoTestBase64;
332
330
setUpAll (() async {
333
331
final ByteData videoData =
334
332
await rootBundle.load ('assets/sample_video.mp4' );
@@ -587,7 +585,7 @@ void main() {
587
585
});
588
586
589
587
group ('Audio playback policy' , () {
590
- String audioTestBase64;
588
+ late String audioTestBase64;
591
589
setUpAll (() async {
592
590
final ByteData audioData =
593
591
await rootBundle.load ('assets/sample_audio.ogg' );
@@ -793,7 +791,7 @@ void main() {
793
791
await pageStarted.future;
794
792
await pageLoaded.future;
795
793
796
- final String title = await controller.getTitle ();
794
+ final String ? title = await controller.getTitle ();
797
795
expect (title, 'Some title' );
798
796
});
799
797
@@ -1094,7 +1092,7 @@ void main() {
1094
1092
.evaluateJavascript ('location.href = "https://www.google.com/"' );
1095
1093
1096
1094
await pageLoads.stream.first; // Wait for the next page load.
1097
- final String currentUrl = await controller.currentUrl ();
1095
+ final String ? currentUrl = await controller.currentUrl ();
1098
1096
expect (currentUrl, 'https://www.google.com/' );
1099
1097
});
1100
1098
@@ -1123,7 +1121,7 @@ void main() {
1123
1121
expect (error.failingUrl, isNull);
1124
1122
} else if (Platform .isAndroid) {
1125
1123
expect (error.errorType, isNotNull);
1126
- expect (error.failingUrl.startsWith ('https://www.notawebsite..com' ),
1124
+ expect (error.failingUrl? .startsWith ('https://www.notawebsite..com' ),
1127
1125
isTrue);
1128
1126
}
1129
1127
});
@@ -1184,8 +1182,8 @@ void main() {
1184
1182
// blocked. Still wait for a potential page change for some time in order
1185
1183
// to give the test a chance to fail.
1186
1184
await pageLoads.stream.first
1187
- .timeout (const Duration (milliseconds: 500 ), onTimeout: () => null );
1188
- final String currentUrl = await controller.currentUrl ();
1185
+ .timeout (const Duration (milliseconds: 500 ), onTimeout: () => '' );
1186
+ final String ? currentUrl = await controller.currentUrl ();
1189
1187
expect (currentUrl, isNot (contains ('youtube.com' )));
1190
1188
});
1191
1189
@@ -1222,7 +1220,7 @@ void main() {
1222
1220
.evaluateJavascript ('location.href = "https://www.google.com"' );
1223
1221
1224
1222
await pageLoads.stream.first; // Wait for second page to load.
1225
- final String currentUrl = await controller.currentUrl ();
1223
+ final String ? currentUrl = await controller.currentUrl ();
1226
1224
expect (currentUrl, 'https://www.google.com/' );
1227
1225
});
1228
1226
});
@@ -1249,7 +1247,7 @@ void main() {
1249
1247
),
1250
1248
);
1251
1249
final WebViewController controller = await controllerCompleter.future;
1252
- final String currentUrl = await controller.currentUrl ();
1250
+ final String ? currentUrl = await controller.currentUrl ();
1253
1251
expect (currentUrl, 'https://flutter.dev/' );
1254
1252
});
1255
1253
@@ -1276,7 +1274,7 @@ void main() {
1276
1274
final WebViewController controller = await controllerCompleter.future;
1277
1275
await controller.evaluateJavascript ('window.open("about:blank", "_blank")' );
1278
1276
await pageLoaded.future;
1279
- final String currentUrl = await controller.currentUrl ();
1277
+ final String ? currentUrl = await controller.currentUrl ();
1280
1278
expect (currentUrl, 'about:blank' );
1281
1279
});
1282
1280
0 commit comments