region.didEnter is only true if the position changes from inside to outside the region. So the variable should be called didExit. However, I need the scenario where the user enters the region. Could it be that there is a bug in the Flutter SDK and didEnter and didExit have been accidentally swapped?
...
final watchRegionStream = geofencingService.getWatchRegionStream();
watchRegionStream?.listen((region) {
if (region.didEnter) {
final waypoint = waypoints.firstWhereOrNull((w) => w.id == region.identifier);
if (waypoint != null) {
geofencingRepo.addVisitedWaypoint(waypoint);
}
}
debugPrint('region: ${region.eventName}');
});
...