Skip to content

Error: The getter 'prop' isn't defined for the type 'Object'. #43505

Closed
@vsevolod19860507

Description

@vsevolod19860507

Is it a bug or a feature?

abstract class A {
  int prop;
}

class B {
  B(this.obj);

  Object obj;

  void meth1(Object obj) {
    if (obj is A) {
      print(obj.prop); // Ok.
    }
  }

  void meth2() {
    if (obj is A) {
      print(obj.prop); // Error: The getter 'prop' isn't defined for the type 'Object'.
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions