Has anyone managed to replace GoogleMaps with OpenStreetMap?

Widgets & Design

Hi guys,

I'm trying for days to replace both PlacePicker and Maps with Markers that are using GoogleMaps to OpenStreetMaps (mostly because of costs). I understand that since it's not natively supported, it's needed to build a widget around it, but it's a pain to make it work, mostly because of dependencies incompatibilities.

What have you tried so far?

So far, the only code that I managed to get it working is the following and still, it is very barebones.

import 'package:osm_search_and_pick/open_street_map_search_and_pick.dart';

class PlaceOSM extends StatefulWidget {
  const PlaceOSM({super.key, this.width, this.height});
  final double? width;
  final double? height;

  @override
  State<PlaceOSM> createState() => _PlaceOSMState();
}

class _PlaceOSMState extends State<PlaceOSM> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Pick a place'),
      ),
      body: OpenStreetMapSearchAndPick(
        //center: LatLong(48.8566, 2.3522),
        onPicked: (pickedData) {
          print(pickedData.latLong.latitude);
          print(pickedData.latLong.longitude);
          print(pickedData.address);
          print(pickedData.addressName);
          Navigator.of(context).pop(); 
        },
        hintText:
            'Search a place...', 
      ),
    );
  }
}
Did you check FlutterFlow's Documentation for this topic?
Yes
7
7 replies