Beginners Dart - Scope with the Static Keyword
class AnimalWithStatic {
static int _counter = 0;
AnimalWithStatic() {
_counter++;
print("There are ${_counter} of us.");
}
static void speak(){
print("Speaking");
run();
}
static void run() => print("Running.");
}
void main() {
AnimalWithStatic cat3 = new AnimalWithStatic();
AnimalWithStatic dog2 = new AnimalWithStatic();
AnimalWithStatic bird = new AnimalWithStatic();
AnimalWithStatic fish = new AnimalWithStatic();
AnimalWithStatic.run();
}