emit method
A fix from the "hardware". Goes through the native filters, the distance filter and the store, then to the stream if one is running. Dropped while paused (background, services off, no permission).
Implementation
void emit(Position p) {
currentFix = p;
final c = _positions;
final req = _request;
if (c == null || req == null) return;
if (background && req.background == null) return;
if (!serviceEnabled || !access.isAllowed) return;
final reason = _nativeFilter!.check(p);
if (reason != null) {
if (req.reportFiltered) c.add(PositionEvent(p, filtered: reason));
return;
}
final last = _lastDelivered;
if (last != null &&
req.distanceFilter > 0 &&
distanceBetween(last.latLng, p.latLng) < req.distanceFilter) {
return;
}
_lastDelivered = p;
_offerStore(p);
c.add(PositionEvent(p));
}