Skip to content

Commit a0d0248

Browse files
committed
autocomplete [nfc]: Set streamId and topic as variables directly
I think this is a bit more idiomatic than setting a record which we promptly destructure; and it doesn't come out any longer.
1 parent adeb012 commit a0d0248

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/model/autocomplete.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,20 @@ class MentionAutocompleteView extends ChangeNotifier {
187187
required PerAccountStore store,
188188
required Narrow narrow,
189189
}) {
190-
final (int?, String?) streamAndTopic;
190+
int? streamId;
191+
String? topic;
191192
switch (narrow) {
192193
case StreamNarrow():
193-
streamAndTopic = (narrow.streamId, null);
194+
streamId = narrow.streamId;
194195
case TopicNarrow():
195-
streamAndTopic = (narrow.streamId, narrow.topic);
196+
streamId = narrow.streamId;
197+
topic = narrow.topic;
196198
case DmNarrow():
197-
streamAndTopic = (null, null);
199+
break;
198200
case CombinedFeedNarrow():
199201
assert(false, 'No compose box, thus no autocomplete is available in ${narrow.runtimeType}.');
200-
streamAndTopic = (null, null);
201202
}
202203

203-
final (streamId, topic) = streamAndTopic;
204204
return store.users.values.toList()
205205
..sort((userA, userB) => _compareByRelevance(userA, userB,
206206
streamId: streamId,

0 commit comments

Comments
 (0)