My abstract class:
abstract class Animal {
void saySomething() {
debugPrint("I'm an animal");
}
}
class Cow implements Animal {
int _mooCount = 0;
Cow();
Cow.withCount(this._mooCount);
Cow action({
String sound,
int setCount,
int removeCount,
bool flushCount
}) {
this._mooCount++;
if (setCount != null) {
this._mooCount = setCount;
}
if (sound != null) {
debugPrint(sound + ",count= " + _mooCount.toString());
} else {
debugPrint("Mooo");
}
return this;
}
void saySomething() {
debugPrint("Auuuuuuuuuuuuuuu");
}
}
Animal myCow = new Cow();
myCow = myCow.action(setCount: 0).action(sound: "Moooooooo");
The method 'action' isn't defined for the class 'Animal'
analysis_options.yaml
analyzer:
strong-mode: true
I/flutter ( 6325): Mooo
I/flutter ( 6325): Moooooooo,count= 1
I/flutter ( 6325): Auuuuuuuuuuuuuuu
As Vyacheslav Egorov said, strong mode has no influence on Dart VM at the moment.