You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently migrating a music app from native Android (using Kotlin) to Flutter, and here are a few improvements that could be done:
using the switch command without break, as it is done in Kotlin with the when command. The reason why it's very useful is that the break could lead to bugs that are very hard to find if you forget it (happened to me a few times and I struggled a lot):
using the for command as it is done in Kotlin. Again, repeating the variable name in the for command can lead to bugs if you copy/paste some code and you forget to rename the variable everywhere for example (happened again once):
for (a in1..10) {...}
for (a in1..10 step 2) {...}
for (a in start until end step 3) {...}
for (a in start downTo end step 4) {...}
// and so on...
also, just like Kotlin, can we get rid once for all of the ; in the end of each line? That would be great!
Thanks.
The text was updated successfully, but these errors were encountered:
The switch statement is very similar to rust's syntax, and I really like it.
Also, having a for loop that takes a range such as 1..10 is much cleaner than for (var i = 0; i < 10; i++) {}.
As to the semicolons at the end of lines, nah. It is good as it is right now. I'm not sure if the entire SDK wouldn't have to be ploughed through in order to bring that change in
As to the semicolons at the end of lines, nah. It is good as it is right now. I'm not sure if the entire SDK wouldn't have to be ploughed through in order to bring that change in
I was skeptical about the semicolons too when I first tried Kotlin, but then I realized how nice it was to not deal with semicolons anymore and how they are actually useless.
And the feature I'm asking for is not to get rid of semicolons, but at least to make them not mandatory anymore (just like Kotlin, in fact, you can use semicolons if you want, even though it's useless).
I'm currently migrating a music app from native Android (using Kotlin) to Flutter, and here are a few improvements that could be done:
switch
command withoutbreak
, as it is done in Kotlin with thewhen
command. The reason why it's very useful is that thebreak
could lead to bugs that are very hard to find if you forget it (happened to me a few times and I struggled a lot):for
command as it is done in Kotlin. Again, repeating the variable name in thefor
command can lead to bugs if you copy/paste some code and you forget to rename the variable everywhere for example (happened again once):;
in the end of each line? That would be great!Thanks.
The text was updated successfully, but these errors were encountered: