gpslocator 0.1.2 gpslocator: ^0.1.2 copied to clipboard
A new flutter plugin which gets the current device location stream ,last location and handles location permissions.
0.1.2 #
gpslocator #
A new flutter plugin for getting for location tracking
Getting Started #
Importing #
import 'package:gpslocator/GpsLocator.dart';
final GpsLocator gpsLocator = new GpsLocator();
Getting the last location #
await gpsLocator.lastLocation.then((lastLocation){
//Last location as Map
});
Checking Permissions #
await gpsLocator.checkPermission.then((permission){
if (permission){
//Permission is Already Granted
}else{
gpsLocator.handlePermission('com.example.gpslocator_example');
}
});
Asking for permission #
gpsLocator.handlePermission('com.example.gpslocator_example');
This handlePermission function takes a parameter of package name and asks for
location permission
Checking wheather location is active #
await gpsLocator.isGpsActive.then((isActive) {
if (isActive){
//location is Active
}
});
Starting Location Stream #
Location stream should be started before listening/subscribing to it
Normal
await gpsLocator.startStream();
Configured
await gpsLocator.startStream(interval: 1000,fastestInterval: 5000,priority: GPSPriority.BALANCED_POWER_ACCURACY);
Stoping Location Stream #
await gpsLocator.stopStream;