jtknox via Dart Misc
2018-11-29 22:32:21 UTC
(If there's an existing group for style related questions, in particularly
clarifications of Effective Dart, please let me know and I'll post there
instead).
I am aware of the preference to fields-and-top-level-variables-final
<https://www.dartlang.org/guides/language/effective-dart/design#prefer-making-fields-and-top-level-variables-final>,
but what about local variables. Consider something like:
set property(String value) {
var oldProperty = _property;
_property = value;
notifyChange(oldProperty, _property);
}
I *could* make `oldProperty` final, but that feels overly verbose. Is there
a consensus on using `var` vs `final` in these cases?
clarifications of Effective Dart, please let me know and I'll post there
instead).
I am aware of the preference to fields-and-top-level-variables-final
<https://www.dartlang.org/guides/language/effective-dart/design#prefer-making-fields-and-top-level-variables-final>,
but what about local variables. Consider something like:
set property(String value) {
var oldProperty = _property;
_property = value;
notifyChange(oldProperty, _property);
}
I *could* make `oldProperty` final, but that feels overly verbose. Is there
a consensus on using `var` vs `final` in these cases?
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/b31bba18-6b15-4ff7-92ec-28cbd9144036%40dartlang.org.
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/b31bba18-6b15-4ff7-92ec-28cbd9144036%40dartlang.org.