admin管理员组文章数量:1125594
Do have an option to use a variable only once in condition and value in Dart? or do you Have any shortened solution.
Conditon:
final phoneHeight = PhoneSize.deviceHeight(context);
final sectionHeight=phoneHeight >=1000?phoneHeight*0.85:phoneHeight;
Do have an option to use a variable only once in condition and value in Dart? or do you Have any shortened solution.
Conditon:
final phoneHeight = PhoneSize.deviceHeight(context);
final sectionHeight=phoneHeight >=1000?phoneHeight*0.85:phoneHeight;
Share
Improve this question
edited 2 days ago
Frank van Puffelen
598k84 gold badges887 silver badges858 bronze badges
asked Jan 9 at 6:17
Palash DeyPalash Dey
841 silver badge8 bronze badges
1
|
1 Answer
Reset to default 1final sectionHeight = switch(PhoneSize.deviceHeight(context)) {
>= 1000 && final v => v * 0.85,
final v => v,
};
本文标签: Is there any shorten solution for repeat var in ternary operator on dartStack Overflow
版权声明:本文标题:Is there any shorten solution for repeat var in ternary operator on dart? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736669219a1946825.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
if
conditional statement which is much more readable – Md. Yeasin Sheikh Commented Jan 9 at 7:00