title: in need to some help to solve this problem "The method 'addListener' was called on null."
body: <p>the error:</p>
  <blockquote>
  <p>The method 'addListener' was called on null.
  Receiver: null
  Tried calling: addListener(Closure: (dynamic) =&gt; dynamic from Function 'addtemp':.)</p>
  </blockquote>
  <p>my code :</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class Temp3 extends StatefulWidget {
    @override
    _Temp3State createState() =&gt; _Temp3State();
  }
  
  class _Temp3State extends State&lt;Temp3&gt; {
    double fenTemp = 0.0, celTemp = 0.0;
    var temperature = ['Fehergeit', 'Clecsies', 'Kalvin'];
    String selctedTemp = 'Fehergeit';
    String selctedTemp1 = 'Clecsies';
    var fenController;
    var celController;
    var kalController;
    bool isFen = true;
    controller(String temp) {
      var s;
      switch (temp.substring(0, 1)) {
        case 'F':
          fenController = TextEditingController();
          s = fenController;
          break;
        case 'C':
          celController = TextEditingController();
          s = celController;
          break;
        default:
          kalController = TextEditingController();
          s = kalController;
      }
      addtemp(s);
    }
  
    @override
    initState() {
      super.initState();
      fenController.addListener(addtemp);
      celController.addListener(addtemp);
      kalController.addListener(addtemp);
    }
  
    addtemp(var s) {
      switch (s) {
        case 'F':
          fenTemp = double.parse(fenController.text);
          celTemp = convert(fenTemp, true);
          if (isFen) celController.text = celTemp.toString();
          isFen = true;
          break;
        case 'C':
          setState(() {
            celTemp = double.parse(celController.text);
            fenTemp = convert(celTemp, false);
            if (!isFen) fenController.text = fenTemp.toString();
            isFen = false;
          });
          break;
        default:
          celTemp = double.parse(celController.text);
      }
    }
  
    // fenListener() {
    //   fenTemp = double.parse(fenController.text);
    //   celTemp = convert(fenTemp, true);
    //   if (isFen) celController.text = celTemp.toString();
    //   isFen = true;
    // }
  
    // celListener() {
    //   setState(() {
    //     celTemp = double.parse(celController.text);
    //     fenTemp = convert(celTemp, false);
    //     if (!isFen) fenController.text = fenTemp.toString();
    //     isFen = false;
    //   });
    // }
    // kalListener(){}
  
    double convert(double temp, bool isF) {
      return isF ? (temp - 32) * (5 / 9) : (temp * (9 / 5) + 32);
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Temperature 3'),
        ),
        body: Padding(
          padding: EdgeInsets.all(15),
          child: Center(
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Expanded(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      DropdownButton(
                        items: temperature.map((item) {
                          return DropdownMenuItem(
                            child: Text(item),
                            value: item,
                          );
                        }).toList(),
                        onChanged: (newValue) {
                          setState(() {
                            selctedTemp = newValue;
                          });
                        },
                        value: selctedTemp,
                      ),
                      TextField(
                        controller: controller(selctedTemp),
                        keyboardType: TextInputType.number,
                        decoration: InputDecoration(
                          hintText: 'Enter temperature',
                          suffixText: selctedTemp.substring(0, 1),
                        ),
                      ),
                    ],
                  ),
                ),
                SizedBox(
                  width: 40,
                ),
                Expanded(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      DropdownButton(
                        value: selctedTemp1,
                        items: temperature.map((item) {
                          return DropdownMenuItem(
                            child: Text(item),
                            value: item,
                          );
                        }).toList(),
                        onChanged: (newValue) {
                          setState(() {
                            selctedTemp1 = newValue;
                          });
                        },
                      ),
                      TextField(
                        controller: controller(selctedTemp1),
                        keyboardType: TextInputType.number,
                        decoration: InputDecoration(
                          hintText: 'Enter temperature',
                          suffixText: selctedTemp1.substring(0, 1),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>how can i solve it :</p>
  <blockquote>
  <p>The following NoSuchMethodError was thrown building Builder:
  The method 'addListener' was called on null.
  Receiver: null
  Tried calling: addListener(Closure: (dynamic) =&gt; dynamic from Function 'addtemp':.)
  The relevant error-causing widget was:
  MaterialApp
  lib\main.dart:11</p>
  </blockquote>
  <p>When the exception was thrown, this was the stack:</p>