Remove unnecessary null checks in dev/benchmarks (#118840)

* Remove unnecessary null checks in dev/benchmarks

* empty
This commit is contained in:
Michael Goderbauer
2023-01-19 20:04:11 -08:00
committed by GitHub
parent ec51d3271e
commit 54217bd4b1
13 changed files with 18 additions and 69 deletions

View File

@@ -78,11 +78,6 @@ class StockData extends ChangeNotifier {
void _fetchNextChunk() {
_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}');
_end();
return;
}
const JsonDecoder decoder = JsonDecoder();
add(decoder.convert(json) as List<dynamic>);
if (_nextChunk < _chunkCount) {

View File

@@ -85,9 +85,7 @@ class StockHomeState extends State<StockHome> {
}
void _handleStockModeChange(StockMode? value) {
if (widget.updater != null) {
widget.updater(widget.configuration.copyWith(stockMode: value));
}
widget.updater(widget.configuration.copyWith(stockMode: value));
}
void _handleStockMenu(BuildContext context, _StockMenuItem value) {

View File

@@ -93,9 +93,7 @@ class StockSettingsState extends State<StockSettings> {
}
void sendUpdates(StockConfiguration value) {
if (widget.updater != null) {
widget.updater(value);
}
widget.updater(value);
}
AppBar buildAppBar(BuildContext context) {

View File

@@ -18,7 +18,6 @@ class _StockSymbolView extends StatelessWidget {
@override
Widget build(BuildContext context) {
assert(stock != null);
final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}';
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
if (stock.percentChange > 0) {

View File

@@ -17,16 +17,7 @@ class StockConfiguration {
required this.debugShowRainbow,
required this.showPerformanceOverlay,
required this.showSemanticsDebugger,
}) : assert(stockMode != null),
assert(backupMode != null),
assert(debugShowGrid != null),
assert(debugShowSizes != null),
assert(debugShowBaselines != null),
assert(debugShowLayers != null),
assert(debugShowPointers != null),
assert(debugShowRainbow != null),
assert(showPerformanceOverlay != null),
assert(showSemanticsDebugger != null);
});
final StockMode stockMode;
final BackupMode backupMode;