下划线通常表示您将不在块内使用该参数,这只是编写代码的好方法,例如:
method(int useful, int useless) { // say I am only going to use 'useful' in this block }上面的代码也可以写成:
method(int useful, int _) { // using '_' means I'm not going to use 2nd parameter in the block}现在回答您的问题:
builder: (_, counter, __) => Translations(counter.value),
意味着你有3个参数
_,
counter并且
__,只有
counter是你使用的是什么,所以第一和第三参数,标注
_和
__。这是编写代码的更简洁的方法。



