Skip to content

type 'String' is not a subtype of type 'bool' #53160

Description

@SobhieSaad

he relevant error-causing widget was:
Result file:/lib/ui/pages/home.dart:91:13
When the exception was thrown, this was the stack:
#0 SharedPreferences.getBool (package:shared_preferences/shared_preferences.dart:65:31)
#1 SharedPreferenceHelper.getBooleanFromSP (package:/helpers/shared_preference_helper.dart:30:55)
#2 Result.build (package:/ui/widgets/result_colored_circle_avatar.dart:23:49)
#3 StatelessElement.build (package:flutter/src/widgets/framework.dart:4291:28)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
...

`Widget dialogContent(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 0.0, right: 0.0),
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround ,

        children: <Widget>[
          Container(
            margin: EdgeInsets.only(top: 5.0, right: 5.0),
            decoration: BoxDecoration(
              color: Colors.white,
              shape: BoxShape.rectangle,
              borderRadius: BorderRadius.circular(16.0),
              boxShadow: <BoxShadow>[
                BoxShadow(
                  color: Colors.black26,
                  blurRadius: 0.0,
                  offset: Offset(0.0, 0.0),
                ),
              ],
            ),
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 15),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: <Widget>[
                  SizedBox(height: 15.0),

                  //=========UPPER value=======
                  Padding(
                    padding: const EdgeInsets.only(top: 15) ,
                    child: Row(
                      children: <Widget>[
                        Text(
                          'T'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            fontWeight: FontWeight.bold,
                            color: black,
                          ),
                        ),

                        Text(
                          ' Core Body Temperature'.tr,
                          style: TextStyle(
                            fontSize: 14.0,
                            color: Colors.grey,
                          ),
                        ),
                        Spacer(),
                       /* GestureDetector(
                          onTap: (){DialogHelper.showAnimatedDialog(context,MyTabbedPage());},
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: <Widget>[
                              Padding(
                                padding: EdgeInsetsDirectional.only(start: 8 ),
                                child: Image.asset('assets/images/infoIcon.png' , height: 16, color: Colors.grey,),
                              ),
                            ],
                          ),
                        ),*/
                      ],
                    ),
                  ),

                  Row(
                    children: <Widget>[
                      Expanded(
                        child: TextField(
                          controller: controller1,

                        ),

                      ),
                      Padding(
                        padding: const EdgeInsets.only(left: 4, right: 4 ),
                        child: Text(
                          unitType,style: TextStyle(color: Colors.blue),
                        ),
                      ),
                      InkWell(
                        onTap: (){
                          setState(() {
                            counter++;
                            if(counter==2) {
                              unitType = "Celsius (C)";
                              temp_low_range=36.5;
                              temp_highrange=37.8;

                            }
                            else if(counter==3)
                            {
                              unitType="Fahrenheit (F)";
                              temp_low_range=97.7;
                              temp_highrange=100.04;


                            }
                          });
                        },
                        child: Image.asset('assets/images/biomarker_icons.png'),

                      ),
                    ],
                  ),



                  //=========== upper range ===============
                  Padding(
                    padding: const EdgeInsets.only(top: 5),
                    child: Row(
                      children: <Widget>[
                        Text(
                          'T'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            fontWeight: FontWeight.bold,
                            color: black,
                          ),
                        ),

                        Text(
                          ' reference range'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            color: Colors.grey,
                          ),
                        ),

                        GestureDetector(
                          onTap: (){DialogHelper.showAnimatedDialog(context, SettingPopup(title: titleReferenceRange,
                            description: contentReferenceRange_part1 + "\n\n"+ contentReferenceRange_part2+"\n\n"
                                + contentReferenceRange_part3,));},
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: <Widget>[
                              Padding(
                                padding: const EdgeInsets.only(left: 8),
                                child: Image.asset('assets/images/infoIcon.png' , height: 16, color: Colors.grey,),
                              ),

                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                  Row(
                    children: <Widget>[
                      Expanded(
                        child: TextField(
                          controller: controller2,
                          decoration: InputDecoration(
                            hintText:temp_low_range.toString(),
                          ),

                        ),
                      ),
                      Text(
                        " _ ",style: TextStyle(color: Colors.black26),
                      ),
                      Expanded(
                        child: TextField(
                          controller: controller3,
                          decoration: InputDecoration(
                            hintText:temp_highrange.toString(),
                          ),

                        ),
                      ),
                    ],
                  ),


                  //== DONE buttonn
                  SizedBox(height: 10),
                  Button(
                    'Done'.tr,
                    color: Colors.white,
                    backgroundColor: shadowColor,
                    tapBackgroundColor: Colors.white,
                    tapTextColor: shadowColor,
                    border: true,
                    onPressed: () {
                      if(controller1.text=="")
                        {
                          Navigator.pop(context);
                        }
                      else
                        {
                          Navigator.pop(context);
                        }


                    },
                    verticalPadding: 12,
                    borderRadius: 24,
                  ),

`

Activity

  1. TahaTesser commented on Mar 24, 2020

    @TahaTesser
    Contributor

    Hi @SobhieSaad
    can you please provide your flutter doctor -v and flutter run --verbose? Also, to better address the issue, would be helpful
    if you could post a minimal code sample to reproduce the problem
    Thank you

  2. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 24, 2020
  3. SobhieSaad commented on Mar 24, 2020

    @SobhieSaad
    Author

    @TahaTesser

    Sure, here it is, and thank you for your support:

    [√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.17763.1098], locale en-US)
    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    X Android license status unknown.
    Try re-installing or updating your Android SDK Manager.
    See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
    [√] Android Studio (version 3.6)
    [√] VS Code (version 1.43.0)
    [√] Connected device (1 available)

    ! Doctor found issues in 1 category.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 24, 2020
  5. TahaTesser commented on Mar 24, 2020

    @TahaTesser
    Contributor

    Hi @SobhieSaad
    can you please provide your flutter run --verbose?
    Also, to better address the issue, would be helpful if you could post a minimal code sample to reproduce the problem because above sample has missing code and isn't minimal sample code to better address the issue
    Thank you

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 24, 2020
  7. SobhieSaad commented on Mar 24, 2020

    @SobhieSaad
    Author

    @TahaTesser
    Thank you, it's solved the problem was , I'm saving a text in shared preferences while it must be a bool.

  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 24, 2020
  9. nateshmbhat commented on Mar 24, 2020

    @nateshmbhat

    this is not flutter issue. this can be closed @TahaTesser

  10. TahaTesser commented on Mar 24, 2020

    @TahaTesser
    Contributor

    Hi @SobhieSaad
    given your last message I feel safe to close this issue,
    if you disagree please write in the comments and I will reopen it.
    Thank you

  11. github-actions commented on Aug 22, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions