toActionItemFromFunction method

ActionItem toActionItemFromFunction(
  1. dynamic passedFunction(
    1. BaseMessage message,
    2. CometChatMessageListControllerProtocol state
    )?
)

toActionItemFromFunction takes a function as parameter and converts CometChatMessageOption to ActionItem with the function onClick as onItemClick

Implementation

ActionItem toActionItemFromFunction(
  Function(BaseMessage message, CometChatMessageListControllerProtocol state)?
      passedFunction,
) {
  return ActionItem(
      id: id,
      title: title,
      iconUrl: icon,
      onItemClick: passedFunction,
      iconTint: iconTint,
      titleStyle: titleStyle,
      iconUrlPackageName: packageName,
      background: backgroundColor);
}