Prefer void to null (#22977)

* Future<void> main

* Future<void>.delayed

* prefer_void_to_Null

* address review comments
This commit is contained in:
Alexandre Ardhuin
2018-10-16 22:03:06 +02:00
committed by GitHub
parent 5efe095895
commit 0fb84e96c7
139 changed files with 373 additions and 385 deletions

View File

@@ -39,7 +39,7 @@ const List<String> _kSkippedDemoTitles = <String>[
'Video',
];
Future<Null> main() async {
Future<void> main() async {
try {
// Verify that _kUnsynchronizedDemos and _kSkippedDemos identify
// demos that actually exist.
@@ -89,8 +89,8 @@ class _LiveWidgetController extends LiveWidgetController {
bool frameSync = true;
/// Waits until at the end of a frame the provided [condition] is [true].
Future<Null> _waitUntilFrame(bool condition(), [Completer<Null> completer]) {
completer ??= Completer<Null>();
Future<void> _waitUntilFrame(bool condition(), [Completer<void> completer]) {
completer ??= Completer<void>();
if (!condition()) {
SchedulerBinding.instance.addPostFrameCallback((Duration timestamp) {
_waitUntilFrame(condition, completer);
@@ -112,11 +112,11 @@ class _LiveWidgetController extends LiveWidgetController {
}
@override
Future<Null> tap(Finder finder, { int pointer }) async {
Future<void> tap(Finder finder, { int pointer }) async {
await super.tap(await _waitForElement(finder), pointer: pointer);
}
Future<Null> scrollIntoView(Finder finder, {double alignment}) async {
Future<void> scrollIntoView(Finder finder, {double alignment}) async {
final Finder target = await _waitForElement(finder);
await Scrollable.ensureVisible(target.evaluate().single, duration: const Duration(milliseconds: 100), alignment: alignment);
}

View File

@@ -46,7 +46,7 @@ void verifyToStringOutput(String name, String route, String testString) {
}
}
Future<Null> smokeDemo(WidgetTester tester, GalleryDemo demo) async {
Future<void> smokeDemo(WidgetTester tester, GalleryDemo demo) async {
// Don't use pumpUntilNoTransientCallbacks in this function, because some of
// the smoketests have infinitely-running animations (e.g. the progress
// indicators demo).
@@ -94,7 +94,7 @@ Future<Null> smokeDemo(WidgetTester tester, GalleryDemo demo) async {
await tester.pump(const Duration(milliseconds: 400)); // Wait until it has finished.
}
Future<Null> smokeOptionsPage(WidgetTester tester) async {
Future<void> smokeOptionsPage(WidgetTester tester) async {
final Finder showOptionsPageButton = find.byTooltip('Toggle options page');
// Show the options page
@@ -133,7 +133,7 @@ Future<Null> smokeOptionsPage(WidgetTester tester) async {
await tester.pumpAndSettle();
}
Future<Null> smokeGallery(WidgetTester tester) async {
Future<void> smokeGallery(WidgetTester tester) async {
bool sendFeedbackButtonPressed = false;
await tester.pumpWidget(