We can use the following code in Flutter:
final String a, b, c, d, e, f, g;
However, should we use the following code instead of the above:
final String a;
final String b;
final String c;
final String d;
final String e;
final String f;
final String g;
You can see that the first code uses only 1 line and the second code uses 7 lines. So, I think we should use the first code instead of the second?
If you need more info feel free to leave a comment!
Is this the Flutter recommended way of writing code for variables declared final
? I would appreciate any help. Thank you in advance!
CodePudding user response:
They both do the same thing. Write it how you want.
final String a = "one", b = "two", c = "three";
Or
I think this is easier to read when initializing variables:
final String a = "one";
final String b = "two";
final String c = "three";