When reading dart code I often see some functions called with just an underscore _ parameter. It\'s bugging me out for some time now and since flutter has improved its analysis
Underscore is normally an indication that you are not going to use that parameter inside the block it is just a good way to write code, for instance:
method(int useful, int useless) {
// say I am only going to use 'useful' in this block
}
Above code can also be written as:
method(int useful, int _) {
// using '_' means I'm not going to use 2nd parameter in the block
}
Answer to your question now:
builder: (_, counter, __) => Translations(counter.value),
means you have 3 parameters _
, counter
and __
, and only counter
is what you are using, so 1st and 3rd parameters are denoted with _
and __
. This is just cleaner way to write code.