title: Try correcting the name to the name of an existing method, or defining a method named 'fetchCity'
body: <p>In order to get weather information about an entered city, I Created a fetch city function as bellow :</p>
  <pre><code>class CityModel  {
  
    final String? name;
    final String? lat;
    final String? lon;
    var cityJSON;
  
    CityModel({
      this.name, 
      this.lat, 
      this.lon});
      String get city{
        return city;
      }
    
    Future&lt;CityModel?&gt;  fetchCity(String cityName) async{
    if (cityJSON == null) {
        var link =&quot;https://raw.githubusercontent.com/dr5hn/countries-states-cities-database/master/cities.json&quot;;
        var  response =  await http.get(Uri.parse(link));
        if (response.statusCode == 200) {
            cityJSON = json.decode(response.body);
        }
    }
     for (var i = 0; i &lt; cityJSON.length; i++) {
        if (cityJSON[i][&quot;name&quot;].toString().toLowerCase() == cityName.toLowerCase()) {
           return CityModel(
             name: cityJSON[i][&quot;name&quot;].toString(),
             lat: cityJSON[i][&quot;latitude&quot;].toString(),
             lon: cityJSON[i][&quot;longitude&quot;].toString(),
           );
        }
     }
  
  return null;
    }
    
  }
  
  </code></pre>
  <p>then, I tried to call it in another file as shown bellow :</p>
  <pre><code> class CurrentWeather extends StatefulWidget {
       
     final Function() updateData;
     CurrentWeather(this.updateData);
     
    @override
    State&lt;CurrentWeather&gt; createState() =&gt; _CurrentWeatherState();
  }
  
  class _CurrentWeatherState extends State&lt;CurrentWeather&gt; {
    bool searchBar = false;
    bool updating = false;
    var focusNode = FocusNode();  
     
      
      @override
      Widget build(BuildContext context) {
        return  GestureDetector(
          onTap: (){
            if(searchBar)
            setState(() {
              searchBar = false;
            });
          },
          child: GlowContainer(
                  height: MediaQuery.of(context).size.height - 250,
                padding: EdgeInsets.only(top: 20, left: 30, right: 30, bottom: 20),
                  margin: EdgeInsets.all(2),
                  glowColor: Color(0xff00A1FF).withOpacity(0.8),
                  borderRadius: BorderRadius.only(
                   bottomLeft: Radius.circular(60),
                    bottomRight: Radius.circular(60), 
                  ),
                  color: Color(0xff00A1FF), 
                  spreadRadius: 5,
                  child: Column(
                    children: [ 
                      Container(
  
                        ///////////// If the user click the Search bar 
                        child:  searchBar?  
                        TextField(
                          focusNode: focusNode,
                          decoration: InputDecoration(
                            border: OutlineInputBorder(borderRadius: BorderRadius.circular(10),),
                            fillColor: Color(0xff030317),
                            filled: true,
                            hintText: &quot;Enter a city Name&quot;,
                          ),
                          textInputAction: TextInputAction.search,
                          onSubmitted: (value) async{
              //My call is here //////////
                       CityModel temp  = await fetchCity(value);
                            if (temp == null) {
                                showDialog(
                                  context: context, 
                                  builder: (BuildContext context){
                                    return AlertDialog(
                                      backgroundColor: Color(0xff030317),
                                      title: Text(&quot;City not found &quot;),
                                      content: Text(&quot;Please check the city name&quot;),
                                      actions: [
                                        TextButton(
                                          onPressed: (){
                                            Navigator.of(context).pop();
                                          },
                                           child: Text(&quot;ok&quot;)),
                                      ],
                                    );
                                  }
                                  );
                                  searchBar = false;
                                  return;
                            }
  
                             city = temp.city;
                             lat = temp.lat!;
                             lon = temp.lon!;
                             updating = true;
                              setState(() {
                                
                              });
                              widget.updateData;
                              searchBar = false;
                              updating = false;
                              setState(() {
                                
                              });
                          },
                        )
                        : Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Icon(CupertinoIcons.square_grid_2x2,
                            color: Colors.white,
                            ),
                            Row(
                              children: [
                              Icon(CupertinoIcons.map_fill, color: Colors.white,),
                              GestureDetector(
                                onTap: (){
                                  searchBar = true;
                                  setState(() {
                                    
                                  });
                                  focusNode.requestFocus();
                                },
                                child: Text(&quot;&quot; + city, style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                  fontSize: 30,
                                ),
                                ),
                              ),
                              ],
                            ),
                             Icon(Icons.more_vert, color: Colors.white,),
                          ],
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: 10),
                        padding: EdgeInsets.all(10),
                        decoration: BoxDecoration(
                          border: Border.all(width: 0.2, color: Colors.white),
                          borderRadius: BorderRadius.circular(30),
                        ),
                        child: Text(
                          updating ? 'updating' : 'updated', style: TextStyle(
                          fontWeight: FontWeight.bold,
                        ),
                        ),
                      ),
                      
                      Container(
                         height: 300, 
                        
                             child: Stack(
                              children: [
                                Image(
                                  width:200 ,
                                  height:200 ,
                                  image: AssetImage(currentTemp!.image!),
                                  fit: BoxFit.fill,
                                  ),
                                  SizedBox(height: 10,),
                                  Positioned(
                                    bottom: 0,
                                    right: 0,
                                    left: 0,
                                    child:Center(
                                      child: Column(
                                        children: [
                                           GlowText(currentTemp!.current!.toString(), 
                                           style: TextStyle(
                                             
                                             fontSize: 100,
                                             fontWeight: FontWeight.bold,
                                           ),
                                           ), 
                                           Text(currentTemp!.name!, 
                                           style: TextStyle(fontSize: 20,),
                                           ),
                                            Text(currentTemp!.day!, 
                                           style: TextStyle(fontSize: 18,),
                                           ),
                                        ],
                                      ),
                                    ),
                                     ),
                              ],
                               ),
                          ),
                         Divider(color: Colors.white,),
                         SizedBox(height: 5,),
                         ExtraWeather(currentTemp!),
                    ],
                  ),
              
           
          ),
        );
      }
  }
  </code></pre>
  <p>I'm getting this error:</p>
  <p>The method 'fetchCity' isn't defined for the type '_CurrentWeatherState'.
  Try correcting the name to the name of an existing method, or defining a method named 'fetchCity'.
  in Advance thank you for your help</p>