peerIdOrNull property

String? get peerIdOrNull

Returns the peer ID, or null when the node has no network identity (offline mode). Callers that need the repo-persisted identity regardless of network state should derive it from the identity seed (see Libp2pRouter.persistedPeerId).

Implementation

String? get peerIdOrNull {
  try {
    return peerId;
  } on StateError {
    return null;
  }
}