Home > Software design >  Flutter || Alternative package for google maps
Flutter || Alternative package for google maps

Time:02-21

i want to use map but not google maps to get my location coordinate and take the data to use it for some purpose, is there any package that are same as google maps ? for some reason i cannot use google maps bcs it's not my self project

CodePudding user response:

apple_maps_flutter was done to simplify the process of combining the google_maps_flutter plugin with apple_maps_flutter to create a cross-platform implementation for Android/iOS called flutter_platform_maps.

 apple_maps_flutter: ^1.1.0

or you can use geolocator which will return user coordinates

import 'package:geolocator/geolocator.dart';

Future<Position> _determinePosition() async {
bool serviceEnabled;
LocationPermission permission;

 serviceEnabled = await Geolocator.isLocationServiceEnabled();
   if (!serviceEnabled) {
     return Future.error('Location services are disabled.');
   }

  permission = await Geolocator.checkPermission();
   if (permission == LocationPermission.denied) {
       permission = await Geolocator.requestPermission();
   if (permission == LocationPermission.denied) {
      return Future.error('Location permissions are denied');
      }
    }

    if (permission == LocationPermission.deniedForever) {
   return Future.error(
    'Location permissions are permanently denied, we cannot request 
 permissions.');
  } 
      return await Geolocator.getCurrentPosition();
}
  • Related