substrExpr method
Calls the substr
function with arbitrary expressions as arguments.
For instance, this call uses substrExpr to remove the last 5 characters from a column. As this depends on its StringExpressionOperators.length, it needs to use expressions:
update(table).write(TableCompanion.custom(
column: column.substrExpr(Variable(1), column.length - Variable(5))
));
When both start and length are Dart values (e.g. Variables or
Constants), consider using substr instead.
Implementation
Expression<String> substrExpr(
Expression<int> start, [
Expression<int>? length,
]) {
return FunctionCallExpression('SUBSTR', [this, start, ?length]);
}