can we use more than one parameters for a dart setter method .? can we use more than one parameters for a dart setter method .? dart dart

can we use more than one parameters for a dart setter method .?


No.

A setter allows you to have your own code called when you write o.x = 42. It allows you to implement the interface of a (non-final) field without actually having a field, or to intercept the writes to a field. That is all.

If you want a single method to be invoked with two arguments, you'll have to use a plain method void setAgeSum(a, b) { _age = a + b; }.