Flutter-GeoFire icon indicating copy to clipboard operation
Flutter-GeoFire copied to clipboard

getLocation CallBack not working

Open AhabLives opened this issue 6 years ago • 0 comments

Both setLocation and removeLocation work fine but not getLocation or queryAtLocation. No error in the logs. I have tested with 'MethodeCahnnel' to Android/Java and all works fine there so I can rule out Firebase Database as an issue ?

....
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
          appBar: new AppBar(
            title: new Text('Plugin example app'),
          ),
          body:
          new Center(
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                new Padding(padding: new EdgeInsets.only(top: 20.0),), 
              new RaisedButton(
                    child: new Text("Set Location"),
                    onPressed: () => geofire.setLocation("MechelenOne", [51.0259, 4.4775], // Necessary
                        new GeoFireEventListener((String key, DatabaseError error) { // Optional
                          String s = error == null ? key : error.toString();
                          print(s);
                        }))
                ),
                new RaisedButton(
                  child: new Text("Print location"),
                  onPressed: () =>  geofire.getLocation("MechelenOne", new LocationCallBack(
                          (String key, List<double> location) {
                        print("Successfully received location!");
                        print(key + ": " + location.toString());
                      },
                          (DatabaseError error) {
                        print("Error receiving location!");
                        print(error.toString());
                      }
                  )),
//                  onPressed: () => getAndPrintLocation(),
                ),
                new RaisedButton(
                    child: new Text("Remove previously set location"),
                    onPressed: () => geofire.removeLocation("MechelenOne")
                ),
...

Any assistance would be greatly appreciated. Thanks.

AhabLives avatar Jul 29 '18 19:07 AhabLives