在flutter中调试时出现异常错误

问题描述 投票:0回答:1

debug控制台在flutter中添加条件语句时出现错误并退出.这很不寻常,我不知道为什么会发生这种情况.flutter doctor很清楚,我不明白这个错误是什么.请帮助...错误是这样的。

E/DartVM  (31111): version=2.7.2 (Mon Mar 23 22:11:27 2020 +0100) on "android_arm64"
E/DartVM  (31111): thread=31167, isolate=main(0x7fa23acc00)
E/DartVM  (31111):   pc 0x0000007f84450d78 fp 0x0000007f82dc81d0 /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so+0x1684d78
E/DartVM  (31111): -- End of DumpStackTrace
E/DartVM  (31111): [exit     : sp(0) fp(0x7f82dc9198) pc(0)]
E/DartVM  (31111): [stub     : sp(0x7f82dc91a8) fp(0x7f82dc91e0) pc(0x7f81282a24)]
E/DartVM  (31111): [dart     : sp(0x7f82dc91f0) fp(0x7f82dc9270) pc(0x7f621e5ab8) package:pmukk_mobile/Screens/Sign_Up_Screen/profile_details_screen.dart__ProfileDetailsState@993294682__buildCountryStateContainer@993294682 ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9280) fp(0x7f82dc9370) pc(0x7f621e0354) package:pmukk_mobile/Screens/Sign_Up_Screen/profile_details_screen.dart__ProfileDetailsState@993294682_build ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9380) fp(0x7f82dc93a8) pc(0x7f6a0c8bb8) package:flutter/src/widgets/framework.dart_StatefulElement_build ]
E/DartVM  (31111): [dart     : sp(0x7f82dc93b8) fp(0x7f82dc9418) pc(0x7f6a565608) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9428) fp(0x7f82dc9450) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9460) fp(0x7f82dc94a0) pc(0x7f7fa35058) package:flutter/src/widgets/framework.dart_StatefulElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc94b0) fp(0x7f82dc94e0) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc94f0) fp(0x7f82dc9538) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9548) fp(0x7f82dc9578) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9588) fp(0x7f82dc9610) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9620) fp(0x7f82dc9648) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9658) fp(0x7f82dc9678) pc(0x7f7fa336e0) package:flutter/src/widgets/framework.dart_StatelessElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9688) fp(0x7f82dc96b8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc96c8) fp(0x7f82dc9710) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9720) fp(0x7f82dc9750) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9760) fp(0x7f82dc97a8) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc97b8) fp(0x7f82dc97e8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc97f8) fp(0x7f82dc9880) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9890) fp(0x7f82dc98b8) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc98c8) fp(0x7f82dc9908) pc(0x7f7fa35058) package:flutter/src/widgets/framework.dart_StatefulElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9918) fp(0x7f82dc9948) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9958) fp(0x7f82dc99a0) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc99b0) fp(0x7f82dc99e0) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc99f0) fp(0x7f82dc9a38) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9a48) fp(0x7f82dc9a78) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9a88) fp(0x7f82dc9b10) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9b20) fp(0x7f82dc9b48) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9b58) fp(0x7f82dc9b98) pc(0x7f7fa35058) package:flutter/src/widgets/framework.dart_StatefulElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9ba8) fp(0x7f82dc9bd8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9be8) fp(0x7f82dc9c70) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9c80) fp(0x7f82dc9ca8) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9cb8) fp(0x7f82dc9cd8) pc(0x7f7fa336e0) package:flutter/src/widgets/framework.dart_StatelessElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9ce8) fp(0x7f82dc9d18) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9d28) fp(0x7f82dc9db0) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9dc0) fp(0x7f82dc9de8) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9df8) fp(0x7f82dc9e38) pc(0x7f7fa35058) package:flutter/src/widgets/framework.dart_StatefulElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9e48) fp(0x7f82dc9e78) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9e88) fp(0x7f82dc9ed0) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9ee0) fp(0x7f82dc9f10) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9f20) fp(0x7f82dc9fa8) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9fb8) fp(0x7f82dc9fe0) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dc9ff0) fp(0x7f82dca018) pc(0x7f6941a770) package:flutter/src/widgets/framework.dart_ProxyElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca028) fp(0x7f82dca070) pc(0x7f6941a264) package:flutter/src/widgets/inherited_notifier.dart__InheritedNotifierElement@787313948_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca080) fp(0x7f82dca0b0) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca0c0) fp(0x7f82dca108) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca118) fp(0x7f82dca148) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca158) fp(0x7f82dca1e0) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca1f0) fp(0x7f82dca218) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca228) fp(0x7f82dca268) pc(0x7f7fa35058) package:flutter/src/widgets/framework.dart_StatefulElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca278) fp(0x7f82dca2a8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca2b8) fp(0x7f82dca340) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca350) fp(0x7f82dca378) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca388) fp(0x7f82dca3a8) pc(0x7f7fa336e0) package:flutter/src/widgets/framework.dart_StatelessElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca3b8) fp(0x7f82dca3e8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca3f8) fp(0x7f82dca440) pc(0x7f6940e4bc) package:flutter/src/widgets/framework.dart_SingleChildRenderObjectElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca450) fp(0x7f82dca480) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca490) fp(0x7f82dca518) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca528) fp(0x7f82dca550) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca560) fp(0x7f82dca588) pc(0x7f6941a770) package:flutter/src/widgets/framework.dart_ProxyElement_update ]
E/DartVM  (31111): [dart     : sp(0x7f82dca598) fp(0x7f82dca5c8) pc(0x7f6a560c08) package:flutter/src/widgets/framework.dart_Element_updateChild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca5d8) fp(0x7f82dca660) pc(0x7f6a565a4c) package:flutter/src/widgets/framework.dart_ComponentElement_performRebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca670) fp(0x7f82dca698) pc(0x7f6a564378) package:flutter/src/widgets/framework.dart_Element_rebuild ]
E/DartVM  (31111): [dart     : sp(0x7f82dca6a8) fp(0x7f82dca738) pc(0x7f6a557680) package:flutter/src/widgets/framework.dart_BuildOwner_buildScope ]
E/DartVM  (31111): [dart     : sp(0x7f82dca748) fp(0x7f82dca790) pc(0x7f69408b64) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding@744399801_drawFrame ]
E/DartVM  (31111): [dart     : sp(0x7f82dca7a0) fp(0x7f82dca7c0) pc(0x7f69408388) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding@744399801__handlePersistentFrameCallback@659452173 ]
E/DartVM  (31111): [dart     : sp(0x7f82dca7d0) fp(0x7f82dca808) pc(0x7f6940822c) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding@744399801__handlePersistentFrameCallback@659452173__handlePersistentFrameCallback@659452173 ]
E/DartVM  (31111): [dart     : sp(0x7f82dca818) fp(0x7f82dca8a8) pc(0x7f69407890) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding@744399801__invokeFrameCallback@694222615 ]
E/DartVM  (31111): [dart     : sp(0x7f82dca8b8) fp(0x7f82dca918) pc(0x7f69406a4c) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding@744399801_handleDrawFrame ]
E/DartVM  (31111): [dart     : sp(0x7f82dca928) fp(0x7f82dca958) pc(0x7f69406504) package:flutter/src/widgets/binding.dart__WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding@744399801_scheduleWarmUpFrame_<anonymous closure> ]
E/DartVM  (31111): [dart     : sp(0x7f82dca968) fp(0x7f82dca9a0) pc(0x7f6a550380) dart:async_Timer__createTimer@9048458_<anonymous closure> ]
E/DartVM  (31111): [dart     : sp(0x7f82dca9b0) fp(0x7f82dca9d8) pc(0x7f7fbae9b8) dart:core__Closure@0150898_call ]
E/DartVM  (31111): [dart     : sp(0x7f82dca9e8) fp(0x7f82dcaa70) pc(0x7f6a54f274) dart:isolate__Timer@1026248__runTimers@1026248 ]
E/DartVM  (31111): [dart     : sp(0x7f82dcaa80) fp(0x7f82dcaaa8) pc(0x7f6a54cfe8) dart:isolate__Timer@1026248__handleMessage@1026248 ]
E/DartVM  (31111): [dart     : sp(0x7f82dcaab8) fp(0x7f82dcaae8) pc(0x7f6a54caac) dart:isolate__Timer@1026248__handleMessage@1026248__handleMessage@1026248 ]
E/DartVM  (31111): [dart     : sp(0x7f82dcaaf8) fp(0x7f82dcab20) pc(0x7f7fbae9b8) dart:core__Closure@0150898_call ]
E/DartVM  (31111): [dart     : sp(0x7f82dcab30) fp(0x7f82dcab58) pc(0x7f7fbb2870) dart:isolate__RawReceivePortImpl@1026248__handleMessage@1026248 ]
E/DartVM  (31111): [entry    : sp(0x7f82dcab68) fp(0x7f82dcac28) pc(0x7f81281a54)]
F/libc    (31111): Fatal signal 6 (SIGABRT), code -6 in tid 31167 (Thread-7)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/santoni/santoni:7.1.2/N2G47H/V11.0.2.0.NAMMIXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 31111, tid: 31167, name: Thread-7  >>> com.cdz.pmukk <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    x0   0000000000000000  x1   00000000000079bf  x2   0000000000000006  x3   0000000000000008
    x4   0000000000000000  x5   0080000000000080  x6   0000007fa60c6000  x7   0000000000000000
    x8   0000000000000083  x9   ffffffffffffffdf  x10  0000000000000000  x11  0000000000000001
    x12  ffffffffffffffff  x13  0000000000000000  x14  0000000000000000  x15  001200335308ab97
    x16  0000007fa3855ec8  x17  0000007fa3803550  x18  0000000070b204cc  x19  0000007f82dcb4f8
    x20  0000000000000006  x21  0000007f82dcb450  x22  0000000000000000  x23  0000007f84818000
    x24  0000007f6f9d6a90  x25  0000007f6f9d6a90  x26  0000007f84813adc  x27  0000000000000001
    x28  0000007f84813ae8  x29  0000007f82dc8170  x30  0000007fa38009e0
    sp   0000007f82dc8150  pc   0000007fa3803558  pstate 0000000060000000
backtrace:
    #00 pc 000000000006b558  /system/lib64/libc.so (tgkill+8)
    #01 pc 00000000000689dc  /system/lib64/libc.so (pthread_kill+64)
    #02 pc 0000000000023f28  /system/lib64/libc.so (raise+24)
    #03 pc 000000000001c9ac  /system/lib64/libc.so (abort+52)
    #04 pc 0000000001580138  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #05 pc 00000000017486cc  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #06 pc 0000000001726a54  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #07 pc 000000000172d4ac  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #08 pc 0000000001804bf8  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #09 pc 0000000001805760  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #10 pc 00000000018052c8  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #11 pc 00000000016416ac  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #12 pc 00000000016c56e4  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #13 pc 00000000016bf45c  /data/app/com.cdz.pmukk-2/lib/arm64/libflutter.so (offset 0x1210000)
    #14 pc 0000000000001450  <anonymous:0000007f81280000>
Lost connection to device.
Exited (sigterm)

这里是我的代码 im 给出的条件语句,没有这个,它不会有任何问题.我的flutter版本是1.12.13+hotfix.9...im两天前刚刚升级了这个版本。

Widget _buildCountryStateContainer() {
    return Padding(
      padding: EdgeInsets.only(top: ScreenUtil().setWidth(20.0)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(
            'Country',
            style: TextStyle(
                color: HexColor("#585858"),
                fontSize: ScreenUtil().setSp(9),
                fontFamily: 'Poppins-Light'),
          ),
          SizedBox(height: ScreenUtil().setHeight(10.0)),
          Container(
            color: HexColor('#F1F9FF'),
            child: new DropdownButton<String>(

              // icon: Icon(Icons.check),
              // iconDisabledColor: Colors.blue,

              underline: Container(
                height: 0,
              ),
              isExpanded: true,
              items: countries.map((String datas) {
                return DropdownMenuItem<String>(

                  value: datas,
                  child: Padding(
                    padding: EdgeInsets.all(ScreenUtil().setWidth(10.0)),
                    // padding: EdgeInsets.all(10),
                    child: Text(
                      datas,
                      style: TextStyle(
                          color: HexColor("#1C2344"),
                          fontSize: ScreenUtil().setSp(12),
                          fontFamily: 'Poppins-ExtraLight'),
                    ),
                  ),
                );
              }).toList(),
              onChanged: (String newValue) async {
                isStateLoading = false;
                // setState(() {
                print(newValue);
                var id;
                countryObj.forEach((doc) {
                  // finding the corresponding country id
                  if (doc['name'] == newValue) {
                    id = doc["id"];
                    dial_code = doc["dial_code"];
                    print(id);
                  }
                });
                setState(() {
                  dropdownValue1 = newValue;
                });

                fetchStates(id, newValue);
                addCities();
              },
              value: dropdownValue1,
            ),
          ),


///problem is while adding this.......................................................................
          showCountryValidator? Container(
            child:Text("hi",style:TextStyle(color:Colors.red))
          ):Container( child:Text("invert",style:TextStyle(color:Colors.red))),
          // SizedBox(height: ScreenUtil().setHeight(18.0)),
//.................................................................................................
          Text(
            'State',
            style: TextStyle(
                color: HexColor("#585858"),
                fontSize: ScreenUtil().setSp(9),
                fontFamily: 'Poppins-Light'),
          ),
          SizedBox(height: ScreenUtil().setHeight(10.0)),
          Container(
            color: HexColor('#F1F9FF'),
            child: new DropdownButton<String>(
              icon:isStateLoading?Icon(Icons.arrow_drop_down)
              : Container(
                height: 20,
                // color: Colors.red,
                child: SpinKitRing(
                  lineWidth: 3,
                  color: Colors.black54,
                ),
              ),
              underline: Container(
                height: 0,
              ),
              isExpanded: true,
              items: states.map((String datas) {
                return DropdownMenuItem<String>(
                  value: datas,
                  child: Padding(
                    padding: EdgeInsets.all(ScreenUtil().setWidth(10.0)),
                    child: Text(
                      datas,
                      style: TextStyle(
                          color: HexColor("#1C2344"),
                          fontSize: ScreenUtil().setSp(12),
                          fontFamily: 'Poppins-ExtraLight'),
                    ),
                  ),
                );
              }).toList(),
              onChanged: (String newValue) async {
                isCityLoading=false;
                setState(() {
                  dropdownValue2 = newValue;
                  print(newValue);
                  print(stateData);
                  var id;
                  stateData.forEach((doc) {
                    //  finding state id
                    if (doc['state'] == newValue) {
                      id = doc["state_id"];
                      print(id);
                    }
                  });
                  fetchCities(id);
                });
              },
              value: dropdownValue2,
            ),
          ),
          SizedBox(height: ScreenUtil().setHeight(18.0)),
          Text(
            'City',
            style: TextStyle(
                color: HexColor("#585858"),
                fontSize: ScreenUtil().setSp(9),
                fontFamily: 'Poppins-Light'),
          ),
          SizedBox(height: ScreenUtil().setHeight(10.0)),
          Container(
            color: HexColor('#F1F9FF'),
            child: new DropdownButton<String>(
              icon:isCityLoading?Icon(Icons.arrow_drop_down)
              : Container(
                height: 20,
                // color: Colors.red,
                child: SpinKitRing(
                  lineWidth: 3,
                  color: Colors.black54,
                ),
              ),
              underline: Container(
                height: 0,
              ),
              isExpanded: true,
              items: city.map((String datas) {
                return DropdownMenuItem<String>(
                  value: datas,
                  child: Padding(
                    padding: EdgeInsets.all(ScreenUtil().setWidth(10.0)),
                    child: Text(
                      datas,
                      style: TextStyle(
                          color: HexColor("#1C2344"),
                          fontSize: ScreenUtil().setSp(12),
                          fontFamily: 'Poppins-ExtraLight'),
                    ),
                  ),
                );
              }).toList(),
              onChanged: (String newValue) async {
                setState(() {
                  dropdownValue3 = newValue;
                  // addStates();
                });
              },
              value: dropdownValue3,
            ),
          ),
        ],
      ),
    );
  }
flutter dart flutter-layout dart-pub
1个回答
0
投票

这是因为我做的一个错误.我只是试图检查布尔表达式的列直接.我只是包裹了一个容器和检查与布尔表达式现在错误出去。 我只是用容器包装,用布尔表达式检查,现在错误出来了。

© www.soinside.com 2019 - 2024. All rights reserved.