loadHistory method

Future<String?> loadHistory()

Re-fetches this conversation from the backend, replacing the transcript.

Anonymous conversations cannot be listed, but one CAN be read back by id from the device that created it — so an app that switched away and back can restore the real transcript instead of trusting a local copy. A no-op while a turn is streaming, and when no conversation exists yet.

Returns the backend's title for the conversation, when it has one.

Implementation

Future<String?> loadHistory() async {
  if (_isStreaming) return null;
  try {
    final detail = await _session.loadHistory();
    _messages = _session.history;
    _error = null;
    notifyListeners();
    return detail?.title;
  } on ChatGptException catch (e) {
    _error = e;
    notifyListeners();
    return null;
  }
}