isAIFeatureEnabled static method

Future<void> isAIFeatureEnabled(
  1. String feature, {
  2. required dynamic onSuccess(
    1. bool isEnabled
    ),
  3. required dynamic onError(
    1. CometChatException e
    ),
})

Implementation

static Future<void> isAIFeatureEnabled(String feature,
    {required Function(bool isEnabled) onSuccess,
    required Function(CometChatException e) onError}) async {
  try {
    if (feature.isEmpty) {
      onError(CometChatException(ErrorCode.errorEmptyFeature,
          ErrorMessage.errorEmptyFeature, ErrorMessage.errorEmptyFeature));
    } else {
      final arguments = {"feature": feature};
      final result =
          await channel.invokeMethod('isAIFeatureEnabled', arguments);
      onSuccess(result);
    }
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}