In the following piece will the ConnectionState.none
and ConnectionState.waiting
give the CircularProgressIndicator
? Is it legal to define cases that way?
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
case ConnectionState.active:
return const CircularProgressIndicator();
case ConnectionState.done:
...
CodePudding user response:
You can use multiple cases too. But instead of multiple cases, we can use or operator in a single switch case itself.
switch (connection) {
case connection.none:
case connection.waiting:
return CircularProgressIndicator();
}