Skip to content

Commit bf45f16

Browse files
gnpricePIG208
authored andcommitted
action_sheet [nfc]: Inline out nullable-bool channelMuted variable
Seeing a condition like `channelMuted != null`, it's not entirely clear what it means for a "channel muted" value to be null. We can express the point more directly as `subscription != null`, and then consult `isMuted` on the subscription.
1 parent 8fe4c6a commit bf45f16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/widgets/action_sheet.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void showTopicActionSheet(BuildContext context, {
154154
required String topic,
155155
}) {
156156
final store = PerAccountStoreWidget.of(context);
157-
final channelMuted = store.subscriptions[channelId]?.isMuted;
157+
final subscription = store.subscriptions[channelId];
158158

159159
final optionButtons = <ActionSheetMenuItemButton>[];
160160

@@ -165,7 +165,7 @@ void showTopicActionSheet(BuildContext context, {
165165

166166
final visibilityOptions = <UserTopicVisibilityPolicy>[];
167167
final visibilityPolicy = store.topicVisibilityPolicy(channelId, topic);
168-
if (channelMuted != null && !channelMuted) {
168+
if (subscription != null && !subscription.isMuted) {
169169
// Channel is subscribed and not muted.
170170
switch (visibilityPolicy) {
171171
case UserTopicVisibilityPolicy.muted:
@@ -189,7 +189,7 @@ void showTopicActionSheet(BuildContext context, {
189189
// our data structures.
190190
assert(false);
191191
}
192-
} else if (channelMuted != null && channelMuted) {
192+
} else if (subscription != null && subscription.isMuted) {
193193
// Channel is muted.
194194
if (supportsUnmutingTopics) {
195195
switch (visibilityPolicy) {

0 commit comments

Comments
 (0)