Skip to content

Commit 0c8a0a8

Browse files
committed
compose_box [nfc]: Call setState post frame in _SendButtonState._hasErrorsChanged
This will prevent throwing the "setState() or markNeedsBuild() called during build" assertion when a recipient is disabled in a DM conversation with compose box being populated with some text, in the next commit.
1 parent 81d6870 commit 0c8a0a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/widgets/compose_box.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,10 @@ class _SendButton extends StatefulWidget {
679679

680680
class _SendButtonState extends State<_SendButton> {
681681
void _hasErrorsChanged() {
682-
setState(() {
683-
// Update disabled/non-disabled state
682+
WidgetsBinding.instance.addPostFrameCallback((_) {
683+
setState(() {
684+
// Update disabled/non-disabled state
685+
});
684686
});
685687
}
686688

0 commit comments

Comments
 (0)