MockHeuristics class
Detailed heuristic data from the native mock-location detection engine.
Only populated when MockDetectionLevel.heuristic is active. Contains
platform-specific signals that indicate whether a location might be
spoofed, even when the platform API flag (isMock) is not set.
The exact set of populated fields depends on the platform:
| Field | Android | iOS |
|---|---|---|
satellites |
✅ | ❌ |
elapsedRealtimeDriftMs |
✅ | ❌ |
timestampDriftMs |
❌ | ✅ |
platformFlagMock |
✅ | ✅ |
Tracelet.onLocation((Location loc) {
if (loc.mockHeuristics != null) {
print('Satellites: ${loc.mockHeuristics!.satellites}');
print('Drift: ${loc.mockHeuristics!.elapsedRealtimeDriftMs}ms');
}
});
- Annotations
Constructors
- MockHeuristics({int? satellites, double? elapsedRealtimeDriftMs, double? timestampDriftMs, bool? platformFlagMock})
-
Creates a new MockHeuristics.
const
-
MockHeuristics.fromMap(Map<
String, Object?> map) -
Creates a MockHeuristics from a platform map.
factory
Properties
- elapsedRealtimeDriftMs → double?
-
Difference in milliseconds between the location's
elapsedRealtimeNanosandSystemClock.elapsedRealtimeNanos()(Android only).final - hashCode → int
-
The hash code for this object.
no setteroverride
- platformFlagMock → bool?
-
Raw platform API mock flag value.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- satellites → int?
-
Number of GPS satellites used for this fix (Android only).
final
- timestampDriftMs → double?
-
Wall-clock timestamp drift in milliseconds (iOS only).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, Object?> - Serializes to a map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override