为什么在 Dart 的 null 安全之后无法访问 List() 构造函数?
// Compile time error: 'List' is deprecated and shouldn't be used.
List<int> foo = List();
Run Code Online (Sandbox Code Playgroud)
但是,您仍然可以这样做:
List<int> foo = []; // No error
Run Code Online (Sandbox Code Playgroud)
那么,两者有什么区别呢?他们都应该显示错误或不显示错误。