In Flutter/Dart the examples sometimes show fat arrow and sometimes dont. Here are examples:
RaisedButton(
onPressed: () {
setState(() {
_myTxt = \"
I found that the mean the exact same thing. The only difference is that you can use (you don't have to) the fat arrow if there is only one statement. Following is the above RaisedButton
declaration with the fat arrow. Notice I had to remove two curly braces and one semi-colon:
RaisedButton(
onPressed: () {
setState(() =>
_myTxt = "Text Changed"
);
},
If you are used to other languages that allow you to put multiple statements after a fat arrow you'll you'll find that you can't in dart and if you try you'll get an error as in the following:
this wont work
RaisedButton(
onPressed: () {
setState(() => {
_myTxt = "Text Changed";
_myTxt = "Never Mind";
});
},