The title says it. Here is a small example:

class Parent {
  const Parent();
}

class Child extends Parent{}

Does Child in this case have a const constructor implicitly, or do I need to define a const constructor explicitly?


Solution 1: hman_codes

I found the answer by chance. I had a 3-level hierarchy of classes, and I defined a const constructor to the topmost parent. I left the (first) child class without defining a constructor. On the second child, I tried to define a const constructor, and I was notified with an error in the code - that its parent didn't have a const constructor.

class Parent {
  const Parent();
}

class Child extends Parent {}

class Grandchild extends Child {
  const Grandchild(); // shows an error
}

TL;DR: child classes need to explicitly define a const constructor, even if their parents already have one.