Home > Software engineering >  Why classes are not extending Object class in source code of Flutter framework?
Why classes are not extending Object class in source code of Flutter framework?

Time:03-16

Looking at the source code of the Flutter, I found out that no class extends the Object class explicitly. I know that, for Java, it is true that every class will be extending Object implicitly. Is it true for Dart also?

CodePudding user response:

Yes.

You can read more about it on flutter.dev

The base class for all Dart objects except null.

Because Object is a root of the non-nullable Dart class hierarchy, every other non-Null Dart class is a subclass of Object.

When you define a class, you should consider overriding toString to return a string describing an instance of that class. You might also need to define hashCode and operator ==, as described in the Implementing map keys section of the library tour.

  • Related