Insert in the dart pad
void main() {
print(Foo().bar);
}
class Foo {
bool get bar => bar;
}
and you will get the warning The getter 'bar' recursively returns itself. Try changing the value being returned.
(From the recursive_getters lint)
I'm wondering why this is only a INFO-level linter warning. Can someone explain?
I think I figured it out myself. Insert
void main() {
print(Fu().gazi);
}
class Fu {
int bla = 1;
bool get gazi {
if(bla < 10) {
bla++;
return gazi;
}
return false;
}
}
and you get the same linter warning. The difference being: The example from the question runs into a runtime error, the example here does not - it's probably not what getters are for (you'd use a function for this), but it works. And thus anything more than an INFO-level warning might be seen as exaggerated here.