start method

Future<void> start([
  1. List<PolyGeofence>? polyGeofenceList
])

Start PolyGeofenceService. It can be initialized with polyGeofenceList.

Implementation

Future<void> start([List<PolyGeofence>? polyGeofenceList]) async {
  if (_isRunningService) return Future.error(ErrorCodes.ALREADY_STARTED);

  await _checkPermissions();
  await _listenStream();

  if (polyGeofenceList != null) _polyGeofenceList.addAll(polyGeofenceList);

  _isRunningService = true;
  _printDevLog('PolyGeofenceService started.');
}