isRealFunction property

bool isRealFunction

Determines whether this string represents a valid real function f(x) or not. For example, this method returns true with the following inputs:

  • "x/2"
  • "3*x-6"
  • "x^2 + sin(x / 2)"
  • "10 + 8"

The only possible variable is "x". The product always needs the * operator.

  • "3x - 5" // Bad
  • "3*x - 5" // Good

Implementation

bool get isRealFunction =>
    length > 0 && ExpressionParser._parser.accept(this);