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

@@ -77,7 +77,7 @@ class StockData extends ChangeNotifier {
static bool actuallyFetchData = true;
void _fetchNextChunk() {
_httpClient.get(_urlToFetch(_nextChunk++)).then<Null>((http.Response response) {
_httpClient.get(_urlToFetch(_nextChunk++)).then<void>((http.Response response) {
final String json = response.body;
if (json == null) {
debugPrint('Failed to load stock data chunk ${_nextChunk - 1}');

View File

@@ -263,7 +263,7 @@ class StockHomeState extends State<StockHome> {
Navigator.pushNamed(context, '/stock:${stock.symbol}');
},
onShow: (Stock stock) {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) => StockSymbolBottomSheet(stock: stock));
_scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) => StockSymbolBottomSheet(stock: stock));
},
);
}

View File

@@ -29,13 +29,13 @@ void main() {
// Scroll down
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
await Future<Null>.delayed(const Duration(milliseconds: 500));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
await Future<Null>.delayed(const Duration(milliseconds: 500));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
});