Skip to content

Commit b37d214

Browse files
committed
Standardize to newer APIs
1 parent 8100ccf commit b37d214

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

lib/src/model/package_graph.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class PackageGraph with CommentReferable, Nameable {
147147
allLibrariesAdded = true;
148148
// Go through docs of every ModelElement in package to pre-build the macros
149149
// index.
150-
await Future.wait(_precacheLocalDocs());
150+
await _precacheLocalDocs().wait;
151151
_localDocumentationBuilt = true;
152152

153153
// Scan all model elements to insure that interceptor and other special
@@ -896,10 +896,7 @@ class PackageGraph with CommentReferable, Nameable {
896896
}
897897

898898
assert(matches.length <= 1);
899-
if (matches.isNotEmpty) {
900-
return matches.first;
901-
}
902-
return null;
899+
return matches.firstOrNull;
903900
}
904901

905902
/// This is used when we might need a Library object that isn't actually

lib/src/validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class Validator {
195195
final links = doc.querySelectorAll('a');
196196
final stringLinks = links
197197
.map((link) => link.attributes['href'])
198-
.whereType<String>()
198+
.nonNulls
199199
.where((href) =>
200200
href.isNotEmpty &&
201201
!href.startsWith('https:') &&

tool/task.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ Future<void> compareFlutterWarnings() async {
298298
'--path',
299299
path.join(flutterDir.absolute.path, 'dev', 'docs', 'doc'),
300300
]);
301-
await Future.wait([original, current]);
301+
await [original, current].wait;
302302
}
303303
}
304304

web/search.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@ void init() {
5353
final url = Uri.parse(window.location.toString());
5454
final searchQuery = url.queryParameters['search'];
5555
if (searchQuery != null) {
56-
final matches = index.find(searchQuery);
57-
if (matches.isNotEmpty) {
58-
final href = matches.first.href;
59-
if (href != null) {
60-
window.location.assign('$_htmlBase$href');
61-
return;
62-
}
56+
final href = index.find(searchQuery).firstOrNull?.href;
57+
if (href != null) {
58+
window.location.assign('$_htmlBase$href');
59+
return;
6360
}
6461
}
6562

0 commit comments

Comments
 (0)