changePath method

void changePath(
  1. String? newPath
)

Implementation

void changePath(String? newPath) {
  final oldPath = _path;
  if (oldPath == newPath) return;
  _path = newPath;
  _cancle?.call();
  _doc = null;
  _loading = true;
  _error = null;
  if (newPath != null) {
    _cancle = _firestoreInstance
        .doc(newPath)
        .snapshots()
        .handleError(_onError)
        .listen(_listen, cancelOnError: false)
        .cancel;
  } else {
    _cancle = null;
  }
  notifyListeners();
}