Q:

type 'int' is not a subtype of type 'double' of 'function result'

I am new to flutter. Stuck in below issue.
  double weight = 0;

  weightIncrement() {
    setState(() {
      weight += 1;
    });
  }

  weightDecrement() {
    setState(() {
      weight -= 1;
    });
  }
      Text(
        cardType == CardType.age ? "$age".toString() : "$weight".toString())

Using above on some button. And setting value to Text throws below error.
I/flutter (22691): The following assertion was thrown building Calculator(dirty, state: _CalculatorState#82a4b):
I/flutter (22691): type 'int' is not a subtype of type 'double' of 'function result'

A:

The error statement itself is giving the answer here, Basically what it says is that the state you are trying to set is of type int and it(The dart compiler) expects it to be of type double. And it assumes that because you have defined the type of weight as a double. (double weight = 0;).
The quick and straightforward solution is to change the type of weight while initializing it as: int weight = 0;
I get your point about why you might be initializing the weight as a double because the weight doesn't have to be a whole number. To follow that, you might want to set the state with a double as follows:
First initialize the weight as double weight = 0.0; then modify your functions as:
   weightIncrement() {
      setState(() {
        weight += 1.0;
      }
   }

And the same for decrementing the weight. 

