changeOnErrorState method
Updates the error state to state and notifies listeners.
Implementation
void changeOnErrorState(final bool state) {
  // Set error flag
  onError = state;
  // Clear image data if error state is true
  if(state) _imageData = null;
  // Notify listeners of state change
  notifyListeners();
}