begin migrating //flutter/dev/tools to null-safety (#80834)

This commit is contained in:
Christopher Fujino
2021-04-23 20:24:03 -07:00
committed by GitHub
parent e5414695d4
commit 8654e4ae3e
33 changed files with 188 additions and 149 deletions

View File

@@ -25,8 +25,8 @@ Future<void> main(List<String> args) async {
/// Fetches the zip archive at the specified url.
///
/// Returns null if the archive fails to download after [maxTries] attempts.
Future<Archive> fetchArchive(String url, int maxTries) async {
List<int> responseBytes;
Future<Archive?> fetchArchive(String url, int maxTries) async {
List<int>? responseBytes;
for (int i = 0; i < maxTries; i++) {
final http.Response response = await http.get(Uri.parse(url));
if (response.statusCode == 200) {
@@ -45,7 +45,7 @@ Future<Archive> fetchArchive(String url, int maxTries) async {
Future<void> generateDocs(String url, String docName, String checkFile) async {
const int maxTries = 5;
final Archive archive = await fetchArchive(url, maxTries);
final Archive? archive = await fetchArchive(url, maxTries);
if (archive == null) {
stderr.writeln('Failed to fetch zip archive from: $url after $maxTries attempts. Giving up.');
exit(1);