processLocation method

Future<bool> processLocation({
  1. required double lat,
  2. required double lng,
  3. required double speed,
  4. required double heading,
  5. double accuracy = 0.0,
  6. double altitude = 0.0,
  7. int? timestamp,
})

Feed an externally sourced GPS fix into the tracking pipeline.

Use this when receiving location data from an external hardware GPS receiver (Bluetooth OBD, serial GPS, etc.).

Implementation

Future<bool> processLocation({
  required double lat,
  required double lng,
  required double speed,
  required double heading,
  double accuracy  = 0.0,
  double altitude  = 0.0,
  int?   timestamp,
}) async {
  try {
    final result = await _method.invokeMethod<bool>(
      'processExternalLocation',
      {
        'lat':       lat,
        'lng':       lng,
        'speed':     speed,
        'heading':   heading,
        'accuracy':  accuracy,
        'altitude':  altitude,
        'timestamp': timestamp ?? DateTime.now().millisecondsSinceEpoch,
      },
    );
    return result ?? false;
  } on PlatformException {
    rethrow;
  }
}