initialise method

void initialise()
override

Implementation

void initialise() {
  _streamSubscription = stream.listen(
    (incomingData) {
      setError(null);
      setMessage(null);
      _error = null;
      notifyListeners();
      // Extra security in case transformData isnt sent
      var interceptedData = transformData(incomingData);

      if (interceptedData != null) {
        _data = interceptedData;
      } else {
        _data = incomingData;
      }

      onData(_data);
      notifyListeners();
    },
    onError: (error) {
      setError(error);
      _error = error;
      _data = null;
      onError(error);
      notifyListeners();
    },
  );

  onSubscribed();
  changeSource = false;
}