这个问题在这里已经有了答案:
Dart datatype naming convention.. Why String instead of string
(2 个回答)
上个月关闭。
在 Dart int 中,double 和 bool 用小写字母声明,为什么字符串声明为 String?
是否有一个原因?
最佳答案
Not exactly, in Java it makes sense because String is not a primitive type like int, String inherit from Object. But in Dart why is String not declared "string" like int, when both inherit from Object class?
大写 Dart 中的每种类型可能更有意义,包括 Int、Double 和 Bool,因为它们都是 Object 的后代,而所有其他类型都大写。所以问题不是为什么 String 大写,而是为什么 int、double 和 bool 没有大写。我假设他们只是选择了一种让 Java 程序员对 Dart 感到熟悉的命名方案,但我真的不知道。
关于string - 为什么在 Dart 中声明字符串要大写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60493086/