getTimezone static method

Future<String?> getTimezone({
  1. dynamic onSuccess(
    1. String response
    )?,
  2. dynamic onError(
    1. CometChatException e
    )?,
})

Retrieves the timezone preference for the logged-in user.

This method makes an asynchronous call to the CometChat server to fetch the timezone preference for the logged-in user. Upon successful retrieval, onSuccess is invoked with the timezone preference. If an error occurs, onError is called with a CometChatException.

Returns a Future<String?>, which completes with the timezone preference if the operation is successful, or null if an error occurs.

Implementation

static Future<String?> getTimezone({Function(String response)? onSuccess,
  Function(CometChatException e)? onError}) async {
  try {
    final result = await channel.invokeMethod('getTimezone');
    if (onSuccess != null) onSuccess(result);
    return result;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}