readyToExecuteAPIRequest static method Null safety

Future<void> readyToExecuteAPIRequest(
  1. {bool force = false}
)

Implementation

static Future<void> readyToExecuteAPIRequest({bool force = false}) async {
  if (force) return;

  final sdk = SendbirdSdk().getInternal();
  final sessionKey = await sdk.sessionManager.getSessionKey();
  final hasValidSession = sessionKey != null && sessionKey.isNotEmpty;
  final hasToken = sdk.state.token != null;
  if (hasValidSession || hasToken) {
    return;
  }

  throw ConnectionRequiredError();
}