open method
Opens this pending session.
Throws an AskarSessionException if the store is closed or if the session is already opened. Returns a Session instance if the session is successfully started.
Implementation
Future<Session> open() async {
if (store.handle == 0) {
throw AskarSessionException('Cannot start session from closed store');
}
if (session != null) {
throw AskarSessionException('Session already opened');
}
try {
final sessionStartResult = await askarSessionStart(
store,
asTransaction: isTransaction,
profile: profile,
);
final sessionHandle = sessionStartResult.getValueOrException();
return Session(handle: sessionHandle, isTransaction: isTransaction);
} catch (e) {
throw AskarSessionException('Failed to start session: $e');
}
}