highlight method

Expression<String> highlight(
  1. GeneratedColumn<String> column, {
  2. required String before,
  3. required String after,
})

Returns the text of column with a match found by an fts5 query wrapped in before and after.

The column must be a column of this fts5 table, otherwise an ArgumentError is thrown. The before and after markers are typically html or markdown tags used to highlight the matching terms.

When column doesn't contain a match for the query of the surrounding statement, its text is returned as it is. This expression only evaluates to null when the value of column is null itself, which can happen for tables storing their contents in another table.

selectOnly(emails)
  ..where(emails.match('reminder'))
  ..addColumns([
    emails.highlight(emails.title, before: '<b>', after: '</b>'),
  ]);

See the sqlite documentation for details.

Implementation

Expression<String> highlight(
  GeneratedColumn<String> column, {
  required String before,
  required String after,
}) {
  return FunctionCallExpression<String>('highlight', [
    _tableReference,
    Variable.withInt(_columnIndex(column)),
    Variable.withString(before),
    Variable.withString(after),
  ]);
}