Skip to main content

no-object-declaration

added in: 1.6.0
Pro+

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;
}
}