Skip to content

Commit

Permalink
fix: showActionsNotifier called after it has been disposed will raise…
Browse files Browse the repository at this point in the history
… an assertion (#919)
  • Loading branch information
LucasXu0 authored Oct 10, 2024
1 parent 6130b16 commit 0a0d441
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ class _BlockComponentActionWrapperState
implements BlockComponentActionState {
final showActionsNotifier = ValueNotifier<bool>(false);

bool isDisposed = false;

bool _alwaysShowActions = false;
bool get alwaysShowActions => _alwaysShowActions;
@override
set alwaysShowActions(bool alwaysShowActions) {
if (isDisposed) {
return;
}
_alwaysShowActions = alwaysShowActions;
if (_alwaysShowActions == false && showActionsNotifier.value == true) {
showActionsNotifier.value = false;
Expand All @@ -51,6 +56,7 @@ class _BlockComponentActionWrapperState

@override
void dispose() {
isDisposed = true;
showActionsNotifier.dispose();

super.dispose();
Expand Down

0 comments on commit 0a0d441

Please sign in to comment.