no-object-declaration
Warns when a class member is declared with the Object
type.
Example
❌ Bad:
class Test {
Object data = 1; // LINT: Avoid 'Object' type declaration on a class member. Try using a different type.
Object get getter => 1; // LINT: Avoid 'Object' type declaration on a class member. Try using a different type.
// LINT: Avoid 'Object' type declaration on a class member. Try using a different type.
Object doWork() {
return;
}
}
✅ Good:
class Test {
int data = 1;
int get getter => 1;
void doWork() {
return;
}
}