I don't see anything on this in the style guide. Moreover, browsing through the Dart SDK code and some pub packages, I do not see any parameters being declared as final. In fact, to get right down to it, I have not seen this done anywhere. (This may just reflect my lack of experience!)
It is manifestly OK to make this declaration, and the Dart editor does use the annotation to flag reassignments as errors.
SO.. is it just too much of a good thing to use final with params, is it not idiomatic Dart, is it in fact a Good Thing, or is there no developed custom with it?
I think most people don't care, and just write nothing because it's shorter. Adding a "final" will catch you assigning to a parameter inadvertently, but I guess that's just not something that happens often enough to be worth the overhead.
I would loathe to have a style guide that requires me to write "final " in front of all my parameters. If I don't assign to it anywhere, I'd expect the compiler to recognize the parameter as effectively being constant (in case there is any performance difference).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With