addOnConnectionChangeListener method

void addOnConnectionChangeListener(
  1. OnConnectionChange listener, {
  2. bool immediately = false,
})

Adds a listener that will be triggered every time the status of the connection to the server changes.

immediately Default true. If true, emits the first event immediately with the current connection status, otherwise it will wait to emit until the connection status changes.

Implementation

void addOnConnectionChangeListener(OnConnectionChange listener, {bool immediately=false}) {
  return getIt.get<ConnectionService>().addOnConnectionChangeListener(listener, immediately: immediately);
}