Flutter/Dart : 如何使用初始化形式初始化名称与字段名称不匹配的命名参数
Flutter/Dart : How to initialize named parameter whose name doesn’t match the name of the field using initializing-formals
https://dart.dev/guides/language/effective-dart/usage#do-use-initializing-formals-when-possible
You can’t always take advantage of it. Sometimes you want to have a
named parameter whose name doesn’t match the name of the field you are
initializing. But when you can use initializing formals, you should.
我找到了上面的解释,但是我可以写什么样的代码来实现上面的解释呢?
如果“初始化formal的参数名”和“字段名”不同,会出错
对不起。
这个解释说“如果我们使用初始化形式,”初始化形式的参数名称“和”字段名称“必须相同”。
https://dart.dev/guides/language/effective-dart/usage#do-use-initializing-formals-when-possible
You can’t always take advantage of it. Sometimes you want to have a named parameter whose name doesn’t match the name of the field you are initializing. But when you can use initializing formals, you should.
我找到了上面的解释,但是我可以写什么样的代码来实现上面的解释呢?
如果“初始化formal的参数名”和“字段名”不同,会出错
对不起。 这个解释说“如果我们使用初始化形式,”初始化形式的参数名称“和”字段名称“必须相同”。