i created flutter app that shows a taost message when no internet connection, but i was trying to return a page clarifies that no internet connection ( before entering the app) instead of toast message is there a way to do it?
class _NotificationState extends State<Notification> {
var subscription;
var connectionStatus;
@override
void initState() {
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
setState(() => connectionStatus = result);
checkInternetConnectivity();
});
checkInternetConnectivity();
// checkLoginStatus();
super.initState();
}
checkInternetConnectivity() {
if (connectionStatus == ConnectivityResult.none) {
return
Fluttertoast.showToast(
msg: "Check your internet connection",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.TOP,
timeInSecForIosWeb: 10,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
}
}
//PS: i tried to return Internet() page instead but it's not working
@override
dispose() {
super.dispose();
subscription.cancel();
}
Widget build(BuildContext context) {