I am aware this question has been asked a few times and I have tried what was suggested, i.e. placing "return" in the right places. I have also followed the instructions in my console and tried to add an empty Container, but what happens is that my screen turns black. So here is my code:
class SettingsPage extends StatefulWidget {
@override
_SettingsPageState createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
bool isSystemSelected;
final stream = AllowedCallInheritedWidget.of(context).allowedCallStream;
return StreamBuilder<String>(
stream: stream,
builder: (context, snapshot) {
if (snapshot.data.toString().contains('PRIORITY_SENDERS_CONTACTS')) {
isSystemSelected = true;
return AlertDialog(
backgroundColor: isSystemSelected ? Colors.blueGrey : Colors.amber,
title: Text(snapshot.data),
);
} else if (snapshot.data
.toString()
.contains('PRIORITY_SENDERS_STARRED')) {
isSystemSelected = true;
return AlertDialog(
backgroundColor: isSystemSelected ? Colors.blueGrey : Colors.amber,
title: Text(snapshot.data),
);
} else if (snapshot.data.toString().contains('PRIORITY_SENDERS_ANY')) {
isSystemSelected = true;
return AlertDialog(
backgroundColor: isSystemSelected ? Colors.blueGrey : Colors.amber,
title: Text(snapshot.data),
);
}
},
);
}
}
What I am trying to do is update android system changes in real time. Thanks for any help!
Edit: I should add that "The offending widget is: StreamBuilder"