Skip to content

Commit 0102cd6

Browse files
authored
[markdown] fix crash test (#2067)
1 parent b963bbf commit 0102cd6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkgs/markdown/test/crash_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ void main() async {
4343
var lastStatus = DateTime(0);
4444
void status(String Function() message) {
4545
if (DateTime.now().difference(lastStatus) >
46-
const Duration(seconds: 30)) {
46+
const Duration(seconds: 5)) {
4747
lastStatus = DateTime.now();
4848
print(message());
4949
}
5050
}
5151

5252
final c = http.RetryClient(http.Client());
53-
Future<dynamic> getJson(String url) async {
53+
Future<Map<String, dynamic>?> getJson(String url) async {
5454
final u = Uri.tryParse(url);
5555
if (u == null) {
5656
return null;
5757
}
5858
try {
5959
final data = await c.read(u);
6060
try {
61-
return jsonDecode(data);
61+
return jsonDecode(data) as Map<String, dynamic>;
6262
} on FormatException {
6363
return null;
6464
}
@@ -70,7 +70,7 @@ void main() async {
7070
}
7171

7272
final packages =
73-
((await getJson('https://pub.dev/api/package-names'))['packages']
73+
((await getJson('https://pub.dev/api/package-names'))!['packages']
7474
as List)
7575
.cast<String>();
7676
//.take(3).toList(); // useful when testing
@@ -84,7 +84,7 @@ void main() async {
8484
final response = await getJson(
8585
'https://pub.dev/api/packages/$package',
8686
);
87-
final entry = response['latest'] as Map?;
87+
final entry = response?['latest'] as Map?;
8888
if (entry != null) {
8989
packageVersions.add(PackageVersion(
9090
package: package,

0 commit comments

Comments
 (0)