geofenceExists static method

Future<bool> geofenceExists(
  1. String identifier
)

Returns true if the SDK already contains the Geofence in its database.

Example

BackgroundGeolocation.geofenceExists('HOME').then((bool exists) {
  if (!exists) {
    BackgroundGeolocation.addGeofence(Geofence(
      identifier: 'HOME',
      latitude: location.latitude,
      longitude location.longitude,
      radius: 200.0,
      notifyOnEntry: true
    ));
  }
});

Implementation

static Future<bool> geofenceExists(String identifier) async {
  return (await _methodChannel.invokeMethod<bool>(
      'geofenceExists', identifier)) as FutureOr<bool>;
}