calculate method

  1. @override
String calculate(
  1. BuildContext context,
  2. List<String> arguments
)
inherited

Returns the result (as the source code) of the calculable expression, given the arguments passed.

Implementation

@override
String calculate(BuildContext context, List<String> arguments) {
  final newRanges = toRanges(ranges);
  var source = newRanges
      .map((e) => e.$1 == e.$2
          ? '{{0}} == ${e.$1}'
          : '{{0}} >= ${e.$1} && {{0}} <= ${e.$2}')
      .join(' || ');
  if (negate) {
    source = '!($source)';
  }

  return Expr<bool>(source).calculate(context, arguments);
}