为什么classes在Flutter框架的源代码中没有扩展Object class?
Why classes are not extending Object class in source code of Flutter framework?
查看Flutter的源代码,我发现没有class显式扩展对象class。我知道,对于 Java,确实每个 class 都将隐式扩展 Object。 Dart 也是如此吗?
是的。
您可以在 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.
查看Flutter的源代码,我发现没有class显式扩展对象class。我知道,对于 Java,确实每个 class 都将隐式扩展 Object。 Dart 也是如此吗?
是的。
您可以在 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.