Skip to content

Commit

Permalink
compose [nfc]: Simplify controller getters to final fields
Browse files Browse the repository at this point in the history
A private final field exposed by a public getter is equivalent to
a public final field: either means that any library can get, and
no library can set.
  • Loading branch information
gnprice committed Dec 3, 2024
1 parent 695624b commit ff85cef
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lib/widgets/compose_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1178,30 +1178,24 @@ class _FixedDestinationComposeBoxBody extends _ComposeBoxBody {
}

sealed class ComposeBoxController {
ComposeContentController get content => _content;
final _content = ComposeContentController();

FocusNode get contentFocusNode => _contentFocusNode;
final _contentFocusNode = FocusNode();
final content = ComposeContentController();
final contentFocusNode = FocusNode();

@mustCallSuper
void dispose() {
_content.dispose();
_contentFocusNode.dispose();
content.dispose();
contentFocusNode.dispose();
}
}

class StreamComposeBoxController extends ComposeBoxController {
ComposeTopicController get topic => _topic;
final _topic = ComposeTopicController();

FocusNode get topicFocusNode => _topicFocusNode;
final _topicFocusNode = FocusNode();
final topic = ComposeTopicController();
final topicFocusNode = FocusNode();

@override
void dispose() {
_topic.dispose();
_topicFocusNode.dispose();
topic.dispose();
topicFocusNode.dispose();
super.dispose();
}
}
Expand Down

0 comments on commit ff85cef

Please sign in to comment.