endSession static method

  1. @Deprecated('This function is deprecated, please use "endSession" of Countly.instance.sessions instead')
Future<String?> endSession()

End session for manual session handling. This method needs to be called for ending a session only if manual session handling is enabled by calling the 'enableManualSessionHandling' method of 'CountlyConfig'.

Implementation

@Deprecated('This function is deprecated, please use "endSession" of Countly.instance.sessions instead')
static Future<String?> endSession() async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "endSession"';
    log('endSession, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "endSession", manual session control enabled:[$_manualSessionControlEnabled]');

  if (!_manualSessionControlEnabled) {
    String error = '"endSession" will be ignored since manual session control is not enabled';
    log(error);
    return error;
  }
  final String? result = await _channel.invokeMethod('endSession');

  return result;
}