title: Futtler error The method 'toDouble' was called on null. Receiver: null Tried calling: toDouble()
body: <p>The method 'toDouble' was called on null. Receiver: null Tried calling: toDouble()...................................................................................................................................................................................................................................................................................................................................................................................................</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Exception caught by widgets library 
  
  The following NoSuchMethodError was thrown building Body(dirty):
  The method 'toDouble' was called on null.
  Receiver: null
  Tried calling: toDouble()
  
  The relevant error-causing widget was
  Body
  lib\…\Sign_in\SignInPage.dart:14
  When the exception was thrown, this was the stack
  #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  #1      double.* (dart:core-patch/double.dart:36:23)
  #2      getProportionateScreenWidth
  package:BFpropertyMb/settings/size_config.dart:29
  #3      Body.build
  package:BFpropertyMb/…/components/body.dart:16
  #4      StatelessElement.build</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import 'package:flutter/material.dart';
  
  class SizeConfig {
    static MediaQueryData _mediaQueryData;
    static double screenWidth;
    static double screenHeight;
    static double defaultSize;
    static Orientation orientation;
  
    void init(BuildContext context) {
      _mediaQueryData = MediaQuery.of(context);
      screenWidth = _mediaQueryData.size.width;
      screenHeight = _mediaQueryData.size.height;
      orientation = _mediaQueryData.orientation;
    }
  }
  
  // Get the proportionate height as per screen size
  double getProportionateScreenHeight(double inputHeight) {
    double screenHeight = SizeConfig.screenHeight;
    // 812 is the layout height that designer use
    return (inputHeight / 812.0) * screenHeight;
  }
  
  // Get the proportionate height as per screen size
  double getProportionateScreenWidth(double inputWidth) {
    double screenWidth = SizeConfig.screenWidth;
    // 375 is the layout width that designer use
    return (inputWidth / 375.0) * screenWidth;
  }</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import 'package:BFpropertyMb/components/custom_surfix_icon.dart';
  import 'package:BFpropertyMb/components/default_button.dart';
  import 'package:BFpropertyMb/components/form_error.dart';
  import 'package:BFpropertyMb/settings/constants.dart';
  import 'package:BFpropertyMb/settings/size_config.dart';
  import 'package:flutter/material.dart';
  
  class SignForm extends StatefulWidget {
    @override
    _SignFormState createState() =&gt; _SignFormState();
  }
  
  class _SignFormState extends State&lt;SignForm&gt; {
    final _formKey = GlobalKey&lt;FormState&gt;();
    String email;
    String password;
    bool remember = false;
    final List&lt;String&gt; errors = [];
  
    void addError({String error}) {
      if (!errors.contains(error))
        setState(() {
          errors.add(error);
        });
    }
  
    void removeError({String error}) {
      if (errors.contains(error))
        setState(() {
          errors.remove(error);
        });
    }
  
    @override
    Widget build(BuildContext context) {
      return Form(
        key: _formKey,
        child: Column(
          children: [
            buildEmailFormField(),
            SizedBox(height: getProportionateScreenHeight(30)),
            buildPasswordFormField(),
            SizedBox(height: getProportionateScreenHeight(30)),
            Row(
              children: [
                Checkbox(
                  value: remember,
                  activeColor: kPrimaryColor,
                  onChanged: (value) {
                    setState(() {
                      remember = value;
                    });
                  },
                ),
                Text("Remember me"),
                Spacer(),
                GestureDetector(
                  onTap: () =&gt; Navigator.pushNamed(
                      context, null),
                  child: Text(
                    "Forgot Password",
                    style: TextStyle(decoration: TextDecoration.underline),
                  ),
                )
              ],
            ),
            FormError(errors: errors),
            SizedBox(height: getProportionateScreenHeight(20)),
            DefaultButton(
              text: "Continue",
              press: () {
                if (_formKey.currentState.validate()) {
                  _formKey.currentState.save();
                  // if all are valid then go to success screen
                  Navigator.pushNamed(context,null);
                }
              },
            ),
          ],
        ),
      );
    }
  
    TextFormField buildPasswordFormField() {
      return TextFormField(
        obscureText: true,
        onSaved: (newValue) =&gt; password = newValue,
        onChanged: (value) {
          if (value.isNotEmpty) {
            removeError(error: kPassNullError);
          } else if (value.length &gt;= 8) {
            removeError(error: kShortPassError);
          }
          return null;
        },
        validator: (value) {
          if (value.isEmpty) {
            addError(error: kPassNullError);
            return "";
          } else if (value.length &lt; 8) {
            addError(error: kShortPassError);
            return "";
          }
          return null;
        },
        decoration: InputDecoration(
          labelText: "Password",
          hintText: "Enter your password",
          // If  you are using latest version of flutter then lable text and hint text shown like this
          // if you r using flutter less then 1.20.* then maybe this is not working properly
          floatingLabelBehavior: FloatingLabelBehavior.always,
          suffixIcon: CustomSurffixIcon(svgIcon: "assets/icons/Lock.svg"),
        ),
      );
    }
  
    TextFormField buildEmailFormField() {
      return TextFormField(
        keyboardType: TextInputType.emailAddress,
        onSaved: (newValue) =&gt; email = newValue,
        onChanged: (value) {
          if (value.isNotEmpty) {
            removeError(error: kEmailNullError);
          } else if (emailValidatorRegExp.hasMatch(value)) {
            removeError(error: kInvalidEmailError);
          }
          return null;
        },
        validator: (value) {
          if (value.isEmpty) {
            addError(error: kEmailNullError);
            return "";
          } else if (!emailValidatorRegExp.hasMatch(value)) {
            addError(error: kInvalidEmailError);
            return "";
          }
          return null;
        },
        decoration: InputDecoration(
          labelText: "Email",
          hintText: "Enter your email",
          // If  you are using latest version of flutter then lable text and hint text shown like this
          // if you r using flutter less then 1.20.* then maybe this is not working properly
          floatingLabelBehavior: FloatingLabelBehavior.always,
          suffixIcon: CustomSurffixIcon(svgIcon: "assets/icons/Mail.svg"),
        ),
      );
    }
  }</code></pre>
  </div>
  </div>
  </p>