title: Flutter How to apply Getx & Obx to ToggleButtons Widget
body: <p>I need to use ToggleButtons widget with getx.</p>
  <p>but I couldn't find any reference about ToggleButtons &amp; getx.</p>
  <p>I tried my best, but I got only Error message below described.</p>
  <p>my quenstion is <strong>How can I use ToggleButtons widget with Getx?</strong></p>
  <ul>
  <li>my code works fine in debug mode, but I got error message in release /profile mode(even it is not include Expanded Widget)</li>
  </ul>
  <p>thank you.</p>
  <blockquote>
  <p>HomePage</p>
  </blockquote>
  <pre><code>    import 'package:mofu_flutter/src/controller/shelf_life_controller.dart';    
      class HomePage extends StatelessWidget {
            final shelfLifeController = Get.put(ShelfLifeController(), permanent: false);
  @override
    Widget build(BuildContext context) {
      return Container(
          child: SafeArea(
              bottom: false,
              child: Scaffold(
          .....
          body:SingleChildScrollView(
          .....
              child: Container(
          .....
              child: Column(
          .....
           Container(
          .....
           Column(
          .....
          .....
          Obx(()=&gt;ToggleButtons(
          ....
           onPressed: (int index) {
                                          shelfLifeController.changeTabIndex(index);
                                        } isSelected: shelfLifeController.isSelected)
  </code></pre>
  <blockquote>
  <p>Controller</p>
  </blockquote>
  <p>import 'package:get/get.dart';</p>
  <pre><code>class ShelfLifeController extends GetxController {
  
    RxList&lt;bool&gt; isSelected = [false, true, false].obs;
    void changeTabIndex(int index) {
    RxInt tabIndex = 0.obs;
      tabIndex.value = index;
            for(int buttonIndex = 0; buttonIndex &lt; isSelected.length; buttonIndex++){
              if(buttonIndex == index){
                isSelected[buttonIndex] = true;
              } else {
                isSelected[buttonIndex] = false;
              }
            }
    }
  
    @override
    void onInit() {
      super.onInit();
    }
  
    @override
    void dispose() {
      super.dispose();
    }
  }
  </code></pre>
  <blockquote>
  <p>Error Message</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/66WqZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/66WqZ.png" alt="Error Message" /></a></p>
  <blockquote>
  <p>Error Screen
  <a href="https://i.stack.imgur.com/AzUWI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AzUWI.png" alt="Error Screen" /></a></p>
  </blockquote>