SpoofDetectionConfig class

Configuration for spoof detection behavior.

Multiple detection factors can be combined for more reliable detection:

  • Mock provider detection (Android)
  • Impossible speed detection
  • Altitude anomalies
  • Accuracy patterns
  • Location provider analysis

Example:

final config = SpoofDetectionConfig(
  enabled: true,
  blockMockLocations: true,
  sensitivity: SpoofSensitivity.high,
  onSpoofDetected: (event) {
    logSecurityEvent('Potential spoof: ${event.factors}');
  },
);
await Locus.setSpoofDetection(config);

Constructors

SpoofDetectionConfig({bool enabled = true, bool blockMockLocations = false, SpoofSensitivity sensitivity = SpoofSensitivity.balanced, double maxPossibleSpeedKph = kMaxPossibleSpeedKph, double maxAltitudeChangePerSecond = kMaxAltitudeChangePerSecondMeters, int minFactorsForDetection = kDefaultMinSpoofFactors, void onSpoofDetected(SpoofDetectionEvent event)?, bool checkMockProvider = true, bool checkDeveloperOptions = false, bool checkMockMode = true, List<String> trustedMockProviders = const []})
Creates spoof detection configuration.
const
SpoofDetectionConfig.fromMap(JsonMap map)
Creates from a map.
factory

Properties

blockMockLocations bool
Whether to completely block mock/spoofed locations.
final
checkDeveloperOptions bool
Whether to check for developer options enabled.
final
checkMockMode bool
Whether to check for location services running in mock mode.
final
checkMockProvider bool
Whether to check for mock provider flag (Android only).
final
enabled bool
Whether spoof detection is enabled.
final
hashCode int
The hash code for this object.
no setterinherited
maxAltitudeChangePerSecond double
Maximum allowed altitude change in meters per second.
final
maxPossibleSpeedKph double
Maximum physically possible speed in km/h.
final
minFactorsForDetection int
Minimum number of detection factors required to flag as spoofed.
final
onSpoofDetected → void Function(SpoofDetectionEvent event)?
Callback when spoofing is detected.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sensitivity SpoofSensitivity
Detection sensitivity level.
final
trustedMockProviders List<String>
List of trusted app signatures for mock location allowlisting.
final

Methods

copyWith({bool? enabled, bool? blockMockLocations, SpoofSensitivity? sensitivity, double? maxPossibleSpeedKph, double? maxAltitudeChangePerSecond, int? minFactorsForDetection, void onSpoofDetected(SpoofDetectionEvent)?, bool? checkMockProvider, bool? checkDeveloperOptions, bool? checkMockMode, List<String>? trustedMockProviders}) SpoofDetectionConfig
Creates a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() JsonMap
Converts to a JSON-serializable map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

balanced → const SpoofDetectionConfig
Balanced detection (default).
disabled → const SpoofDetectionConfig
Disabled detection.
high → const SpoofDetectionConfig
High sensitivity - more aggressive detection.
low → const SpoofDetectionConfig
Low sensitivity - fewer false positives.
strict → const SpoofDetectionConfig
Financial/security grade - strictest detection.