I have a unique situation where flutter/dart seems to be requiring a coma for line endings instead of semi colon and I am completely baffled. Is this correct behavior or is there some major bug going on?
SharedPreferences.getInstance().then((prefs) => {
prefs.setString("auth", sr.data);
prefs.setString("phone", myPhone);
}
produces the error "Expected to find '}'
if I change them to commas its totall fine
SharedPreferences.getInstance().then((prefs) => {
prefs.setString("auth", sr.data),
prefs.setString("phone", myPhone),
}
I have a lot more code in here with if statements and other things going on but its all the same. Any semicolon produces the error and commas seem to make everything happy. If this is correct behavior how do I know when commas are needed??
() {} requires semi column
SharedPreferences.getInstance().then((prefs) {
prefs.setString("auth", sr.data);
prefs.setString("phone", myPhone);
}
() => {} requires comma
SharedPreferences.getInstance().then((prefs) => {
prefs.setString("auth", sr.data),
prefs.setString("phone", myPhone),
}