Line data Source code
1 : import '../enums/enums.dart'; 2 : 3 : /// Represents different options to configure the quality and frequency 4 : /// of location updates. 5 : class LocationOptions { 6 : /// Initializes a new [LocationOptions] instance with default values. 7 : /// 8 : /// The following default values are used: 9 : /// - accuracy: best 10 : /// - distanceFilter: 0 11 : /// - forceAndroidLocationManager: false 12 : /// - timeInterval: 0 13 1 : const LocationOptions( 14 : {this.accuracy = LocationAccuracy.best, 15 : this.distanceFilter = 0, 16 : this.forceAndroidLocationManager = false, 17 : this.timeInterval = 0}); 18 : 19 : /// Defines the desired accuracy that should be used to determine the 20 : /// location data. 21 : /// 22 : /// The default value for this field is [LocationAccuracy.best]. 23 : final LocationAccuracy accuracy; 24 : 25 : /// The minimum distance (measured in meters) a device must move 26 : /// horizontally before an update event is generated. 27 : /// 28 : /// Supply 0 when you want to be notified of all movements. The default is 0. 29 : final int distanceFilter; 30 : 31 : /// Forces the Geolocator plugin to use the legacy LocationManager instead of 32 : /// the FusedLocationProviderClient (Android only). 33 : /// 34 : /// Internally the Geolocator will check if Google Play Services are installed 35 : /// on the device. If they are not installed the Geolocator plugin will 36 : /// automatically switch to the LocationManager implementation. However if you 37 : /// want to force the Geolocator plugin to use the LocationManager 38 : /// implementation even when the Google Play Services are installed you could 39 : /// set this property to true. 40 : final bool forceAndroidLocationManager; 41 : 42 : /// The desired interval for active location updates, in milliseconds 43 : /// (Android only). 44 : /// 45 : /// On iOS this value is ignored since position updates based on time 46 : /// intervals are not supported. 47 : final int timeInterval; 48 : 49 : /// Serializes the [LocationOptions] to a map message. 50 2 : Map<String, dynamic> toJson() => <String, dynamic>{ 51 2 : 'accuracy': accuracy.index, 52 1 : 'distanceFilter': distanceFilter, 53 1 : 'forceAndroidLocationManager': forceAndroidLocationManager, 54 1 : 'timeInterval': timeInterval 55 : }; 56 : }