Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include null in the type that UpdateUrlFetcher's Future returns #70324

Merged
merged 1 commit into from Nov 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/material.dart';

import 'package:url_launcher/url_launcher.dart';

typedef UpdateUrlFetcher = Future<String> Function();
typedef UpdateUrlFetcher = Future<String?> Function();

class Updater extends StatefulWidget {
const Updater({ required this.updateUrlFetcher, this.child, Key? key })
Expand Down Expand Up @@ -35,9 +35,9 @@ class UpdaterState extends State<Updater> {
}
_lastUpdateCheck = DateTime.now();

final String updateUrl = await widget.updateUrlFetcher();
final String? updateUrl = await widget.updateUrlFetcher();
final bool? wantsUpdate = await showDialog<bool>(context: context, builder: _buildDialog);
if (wantsUpdate != null && wantsUpdate)
if (wantsUpdate != null && updateUrl != null && wantsUpdate)
launch(updateUrl);
}

Expand Down