enable method

void enable({
  1. dynamic onSuccess(
    1. bool success
    )?,
  2. dynamic onError(
    1. CometChatException exception
    )?,
})

Method to populate data source

Implementation

void enable(
    {Function(bool success)? onSuccess,
    Function(CometChatException exception)? onError}) {
  CometChat.isExtensionEnabled(getExtensionId(), onSuccess: (bool success) {
    if (success) {
      addExtension();
    }
    if (onSuccess != null) {
      onSuccess(success);
    }
  }, onError: (CometChatException exception) {
    if (onError != null) {
      onError(exception);
    }
    if (kDebugMode) {
      debugPrint(
          "Exception occurred while enabling ${getExtensionId()} extension: ${exception.details}");
    }
  });
}