makeQuerySuggestions method

String? makeQuerySuggestions(
  1. String query
)

If the return value == '', then only the tag was entered, if the value == null, then there are no suggestions. Otherwise all matching suggestions will be returned

Implementation

String? makeQuerySuggestions(String query) {
  String? searchQuery;
  final queryWithoutTag = query.replaceAll('\n', '');
  final queryLength = queryWithoutTag.length;

  /// if the query has characters in addition to @ symbol
  if (queryLength > 1) {
    final match = regexpWithTag(tag).stringMatch(queryWithoutTag);

    /// if the whole query matches the pattern
    if (match?.length == queryLength) {
      searchQuery = queryWithoutTag.substring(1);
    }
  } else {
    /// if the query is only [tag] symbol, request all suggestions
    searchQuery = '';
  }

  return searchQuery;
}