title: why in DropdownButtonFormField item my CupertinoSwitch value doesn't change in flutter
body: <p>i'm using provider package for my states i have CupertinoSwitch in my DropdownMenuItem when switch CupertinoSwitch and data change when close DropdownMenuItem data changed but when DropdownMenuItem is open no changes in CupertinoSwitch  value
  this is my widget for select</p>
  <pre><code>import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:provider/provider.dart';
  import '../../providers/store.dart';
  
  class FILTER_SELECT extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      final storeFunc = Provider.of&lt;Barbers&gt;(context);
      return Directionality(
        textDirection: TextDirection.ltr,
        child: Container(
          child: Column(
            children: [
              Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
                Center(
                  child: Container(
                    width: MediaQuery.of(context).size.width &gt; 600
                        ? 290
                        : MediaQuery.of(context).size.width / 2.1,
                    child: Column(
                      children: [
                        Text(
                          &quot;برند&quot;,
                          style: TextStyle(fontSize: 12),
                        ),
                        SizedBox(
                          height: 10,
                        ),
                        DropdownButtonFormField&lt;dynamic&gt;(
                          focusColor: Colors.white,
                          decoration: InputDecoration(
                            isDense: true,
                            contentPadding: EdgeInsets.all(12),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(10),
                            ),
                          ),
                          isExpanded: true,
                          hint: Text(
                            &quot;برند&quot;,
                            style: TextStyle(fontSize: 12, fontFamily: &quot;Shabnam&quot;),
                          ),
                          icon: const Icon(
                            Icons.arrow_drop_down,
                            color: Colors.black45,
                          ),
                          iconSize: 20,
                          items: storeFunc.selectedBrandArray
                              .map((item) =&gt; DropdownMenuItem&lt;dynamic&gt;(
                                  value: item,
                                  child: Directionality(
                                    textDirection: TextDirection.rtl,
                                    child: Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.spaceBetween,
                                      children: [
                                        Expanded(
                                            child: MediaQuery.of(context)
                                                        .size
                                                        .width &gt;
                                                    400
                                                ? Text(
                                                    &quot;${item[&quot;english&quot;]}&quot;,
                                                    overflow:
                                                        TextOverflow.ellipsis,
                                                    style: const TextStyle(
                                                        fontSize: 10,
                                                        fontFamily: &quot;Shabnam&quot;,
                                                        color: Colors.grey),
                                                  )
                                                : SizedBox(
                                                    width: 1,
                                                  )),
                                        Expanded(
                                          child: Text(
                                            &quot; ${item[&quot;brandName&quot;]}&quot;,
                                            overflow: TextOverflow.ellipsis,
                                            style: const TextStyle(
                                                fontSize: 12,
                                                fontFamily: &quot;Shabnam&quot;),
                                          ),
                                        ),
                                        Expanded(
                                          child: Transform.scale(
                                            scale: 0.6,
                                            child: CupertinoSwitch(
                                              value: item[&quot;selected&quot;],
                                              onChanged: (_) {
                                             &quot;here is function to change selected item to true of false &quot;
                                              },
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  )))
                              .toList(),
                          onChanged: (select) {
                            print(select);
                            // storeFunc.changeBrand(select);
                          },
                          value: storeFunc.selectedBrandArray[0],
                        ),
                      ],
                    ),
                  ),
                ),
              ])
            ],
          ),
        ),
      );
    }
  }
  
  
  </code></pre>
  <p>and this is my state</p>
  <pre><code>List&lt;dynamic&gt; _selectedBrandArray = [
      {&quot;brandName&quot;: &quot;الارو&quot;, &quot;english&quot;: &quot;Elaro&quot;, &quot;selected&quot;: false},
      {&quot;brandName&quot;: &quot;اسنس&quot;, &quot;english&quot;: &quot;Essence&quot;, &quot;selected&quot;: true},
      {&quot;brandName&quot;: &quot;آردن&quot;, &quot;english&quot;: &quot;Ardene&quot;, &quot;selected&quot;: false},
      {&quot;brandName&quot;: &quot;این لی&quot;, &quot;english&quot;: &quot;Inlay&quot;, &quot;selected&quot;: false},
  ]
  
  </code></pre>
  <p>again data will change but not when DropdownMenuItem is open and value of CupertinoSwitch doesn't change in ui</p>