selectionCharacterBool method

bool selectionCharacterBool({
  1. required AwsFormatOptionMD formatOption,
  2. required String selectionText,
})

Implementation

bool selectionCharacterBool({
  required AwsFormatOptionMD formatOption,
  required String selectionText,
}) {
  switch (formatOption) {
    case AwsFormatOptionMD.formatStartEnd:
      return selectionText.contains(character!, 0) &&
          selectionText.contains(character!, 1);
    case AwsFormatOptionMD.formatStart:

      /// if same -> remove /// if other -> remove AND add new
      if (multipleCharacters != null) {
        for (var i = 0; i < multipleCharacters!.length; i++) {
          if (selectionText.contains(multipleCharacters![i])) {
            return true;
          }
        }
      }
      return selectionText.contains(character!);
    case AwsFormatOptionMD.formatList:
      var exp = RegExp(r'[0-9]. ');

      /// if same -> remove /// if other -> remove AND add new
      if (multipleCharacters != null) {
        for (var i = 0; i < multipleCharacters!.length; i++) {
          if (selectionText.contains(multipleCharacters![i])) {
            return true;
          } else {
            //return false;
          }
        }
      }
      return selectionText.contains(orderedList == true ? exp : character!);
    case AwsFormatOptionMD.formatAddNew:
      return selectionText.contains(character!);
    default:
      return false;
  }
}