hasChanged property
Gets a value that indicates if a change has occurred.
Implementation
@override
bool get hasChanged {
if (_hasChanged) {
return true;
}
// Check if cancellation was requested
if (_cancellationTokenSource?.isCancellationRequested ?? false) {
_hasChanged = true;
return true;
}
// Only check if enough time has passed since last check
final now = DateTime.now();
if (_lastCheckedTime != null &&
now.difference(_lastCheckedTime!) < _pollingInterval) {
return false;
}
_lastCheckedTime = now;
final currentState = _getCurrentState();
// Check if the state has changed
if (_previousState == null) {
_hasChanged = currentState.isNotEmpty;
} else {
// Check for added, removed, or modified files
_hasChanged = _stateHasChanged(_previousState!, currentState);
}
if (_hasChanged) {
_previousState = currentState;
}
return _hasChanged;
}