allinone_location 1.0.5 copy "allinone_location: ^1.0.5" to clipboard
allinone_location: ^1.0.5 copied to clipboard

Unified Flutter package for permission handling, multi-sample high-accuracy location, and screen-off background location tracking.

AllInOne Location (allinone_location) #

A unified Flutter package for permission management, high-accuracy location fetching, and persistent background location tracking (screen-off capable).

Features #

  • Unified Permission Management: Easily request location (foreground & background), notification, and device permissions.
  • Multi-sample High Accuracy: Get precise GPS coordinates with fallback mechanisms and multi-sample averaging.
  • Persistent Background Tracking: Reliable background service execution supporting screen-off operation and foreground notifications.
  • Zero Config Setup: Minimal boilerplate required to get started.

Getting Started #

Add allinone_location to your pubspec.yaml:

dependencies:
  allinone_location: ^1.0.0

Platform Setup #

Android #

Add the required permissions and service declarations in android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>

iOS #

Add location usage descriptions in ios/Runner/Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>This app requires access to your location when open.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app requires background location access for persistent tracking.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app requires background location access for persistent tracking.</string>
<key>UIBackgroundModes</key>
<array>
    <string>location</string>
    <string>fetch</string>
</array>

Usage #

Single Import #

import 'package:allinone_location/allinone_location.dart';

1. Requesting Permissions #

// Request foreground and background location permissions
final results = await AllInOnePermission.requestAllPermissions();
if (results.values.any((s) => s.isGranted)) {
  print('Location permissions granted!');
}

2. High-Accuracy Location Fetching #

// Fetch single high-accuracy location sample
final location = await AllInOneLocationService.getCurrentLocation();
print('Latitude: ${location.latitude}, Longitude: ${location.longitude}');

3. Background Tracking Service #

// Initialize and start background service
await AllInOneBackground.initializeService();
await AllInOneBackground.startTracking();

// Check service status
final isRunning = await AllInOneBackground.isTrackingRunning();
print('Background tracking active: $isRunning');

// Stop background tracking
await AllInOneBackground.stopTracking();

Additional Information #

For issues, feature requests, or contributions, please open an issue on the repository.

3
likes
0
points
675
downloads

Publisher

unverified uploader

Weekly Downloads

Unified Flutter package for permission handling, multi-sample high-accuracy location, and screen-off background location tracking.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_background_service, flutter_local_notifications, geolocator, permission_handler, shared_preferences

More

Packages that depend on allinone_location