addOption method

  1. @override
int addOption(
  1. String templateId,
  2. CometChatDetailsOption newOption, {
  3. int? position,
})
override

Implementation

@override
int addOption(String templateId, CometChatDetailsOption newOption,
    {int? position}) {
  int actionIndex = -1;
  if (optionsMap[templateId] != null) {
    if (position != null && position < optionsMap[templateId]!.length) {
      optionsMap[templateId]!.insert(position, newOption);
      actionIndex = position;
    } else {
      optionsMap[templateId]!.add(newOption);
      actionIndex = optionsMap[templateId]!.length;
    }

    update();
  }
  return actionIndex;
}