startLoading method

void startLoading()

Initiates the loading process and notifies listeners.

Implementation

void startLoading() {
  // Reset existing stream if any
  if(stream != null) stream = null;
  // Create new StreamController for loading state
  stream = StreamController<bool>();
  // Add loading state event
  stream?.add(true);
  // Notify listeners about state change
  notifyListeners();
}