getOrCreateSession method
Retrieves an existing session or creates a new one if none exists.
This method first attempts to retrieve an existing session by calling
_getSession()
. If a session is found, it is returned. If no session
is found, a new session is created by calling _createSession()
.
Returns:
A Future
that completes with an InternalSession
object.
Implementation
Future<InternalSession> getOrCreateSession() async {
final data = await _getSession();
if (data != null) {
return data;
}
return _createSession();
}