From 686945431bc4f61a316ced7a55393d42b669207c Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Mon, 26 Jun 2023 17:51:41 +0200 Subject: [PATCH] settings: use requireData for AsyncSnapshots --- packages/settings/lib/src/widgets/checkbox_settings_tile.dart | 2 +- .../lib/src/widgets/dropdown_button_settings_tile.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/settings/lib/src/widgets/checkbox_settings_tile.dart b/packages/settings/lib/src/widgets/checkbox_settings_tile.dart index 3971ee33..72c99838 100644 --- a/packages/settings/lib/src/widgets/checkbox_settings_tile.dart +++ b/packages/settings/lib/src/widgets/checkbox_settings_tile.dart @@ -18,7 +18,7 @@ class CheckBoxSettingsTile extends InputSettingsTile { : CheckboxListTile( title: Text(option.label(context)), value: value, - onChanged: enabledSnapshot.data! + onChanged: enabledSnapshot.requireData ? (final value) async { await option.set(value!); } diff --git a/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart b/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart index 3f006644..89b9dbcd 100644 --- a/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart +++ b/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart @@ -42,12 +42,12 @@ class DropdownButtonSettingsTile extends InputSettingsTile> { child: DropdownButton( isExpanded: true, value: value, - items: valuesSnapshot.data!.keys + items: valuesSnapshot.requireData.keys .map( (final k) => DropdownMenuItem( value: k, child: Text( - valuesSnapshot.data![k]!(context), + valuesSnapshot.requireData[k]!(context), overflow: TextOverflow.ellipsis, ), ),