浏览代码

make toggleValue nullable

ashilkn 2 年之前
父节点
当前提交
25195e369c
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lib/ui/components/toggle_switch_widget.dart

+ 2 - 2
lib/ui/components/toggle_switch_widget.dart

@@ -26,7 +26,7 @@ class ToggleSwitchWidget extends StatefulWidget {
 }
 }
 
 
 class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
 class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
-  late bool toggleValue;
+  bool? toggleValue;
   ExecutionState executionState = ExecutionState.idle;
   ExecutionState executionState = ExecutionState.idle;
   final _debouncer = Debouncer(const Duration(milliseconds: 300));
   final _debouncer = Debouncer(const Duration(milliseconds: 300));
 
 
@@ -96,7 +96,7 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
                       });
                       });
                     }
                     }
                   } else {
                   } else {
-                    toggleValue = !toggleValue;
+                    toggleValue = !toggleValue!;
                     executionState = ExecutionState.idle;
                     executionState = ExecutionState.idle;
                   }
                   }
                 });
                 });