Home > Back-end >  how to pick an address from map in flutter
how to pick an address from map in flutter

Time:10-09

I want to create a widget that show google map with initial location, when user click on it it open google map with a marker and allow user to search or select a location from map, then show it in text under the map widget.

Column(
          children: [
            Container(
                height: 200,
                width: double.infinity,
                child: Scaffold(
                  body: GoogleMap(
                    mapType: MapType.normal,
                    initialCameraPosition: CameraPosition(target: _initialcameraposition),
                    onMapCreated: (GoogleMapController controller) {
                      _controller.complete(controller);
                    },
                    onTap: (LatLng location){ },
                  ),
                ),
            ),
            
            Text("$address")
          ],
        )

CodePudding user response:

The google maps plugin for flutter doesn't provide geocoding, with the long/lat you can then use a package like https://pub.dev/packages/geocoding which let you gen an address from lat and long coordinates.

  • Related