2021年3月10日星期三

Instance member can't be accessed from a static method Flutter

Any idea why I' getting that error ?

class appBlocs with ChangeNotifier {    final geo = geolocation();    final services = placesCall();      static Position current;    static List<places> searchResponse;      appBlocs() {      setLocation();    }      setLocation() async {      current = await geo.showCurrentLocation();      notifyListeners();    }      // ignore: non_constant_identifier_names    searching(String term) async {      searchResponse = await services.autocomplete(term);      notifyListeners();    }  }  

the error shows at this line onChanged: (value) => appBlocs.searching. I'm kind of lost to be honest

      body: (appBlocs.current == null)            ? Center(                child: CircularProgressIndicator(),              )            : ListView(                children: [                  Padding(                    padding: const EdgeInsets.all(8.0),                    child: TextField(                      decoration: InputDecoration(                          hintText: ' Search your Bakery ...',                          suffix: Icon(Icons.search)),                      onChanged: (value) => appBlocs.searching,                    ),                  ),                    

Thank you in advance for your help

https://stackoverflow.com/questions/66574947/instance-member-cant-be-accessed-from-a-static-method-flutter March 11, 2021 at 08:44AM

没有评论:

发表评论