-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Platform
Windows 11 (also occurs on Windows 10)
Plugin
connectivity_plus
Version
7.0.0
Flutter SDK
3.35.7
Steps to reproduce
- Create a new Flutter project with Windows support:
flutter create -p windows my_app - Add
connectivity_plus: ^6.0.5topubspec.yaml - Run
flutter pub get - Replace
lib/main.dartwith the code sample below - Run on Windows:
flutter run -d windows - Observe the PlatformException being thrown in the console
The error occurs immediately when the app tries to listen to connectivity changes.
Code Sample
**main.dart:**
import 'package:flutter/material.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Connectivity Test',
home: const ConnectivityTestScreen(),
);
}
}
class ConnectivityTestScreen extends StatefulWidget {
const ConnectivityTestScreen({Key? key}) : super(key: key);
@override
State<ConnectivityTestScreen> createState() => _ConnectivityTestScreenState();
}
class _ConnectivityTestScreenState extends State<ConnectivityTestScreen> {
late StreamSubscription<List<ConnectivityResult>> _connectivitySubscription;
String _status = 'Initializing...';
@override
void initState() {
super.initState();
_setupConnectivityListener();
}
void _setupConnectivityListener() {
try {
print('π΅ Setting up connectivity listener...');
_connectivitySubscription = Connectivity().onConnectivityChanged.listen(
(List<ConnectivityResult> result) {
setState(() {
_status = 'Connected: ${result.toString()}';
});
print('β
Connectivity changed: $result');
},
onError: (error) {
print('β Error in connectivity stream: $error');
setState(() {
_status = 'Error: $error';
});
},
);
print('β
Listener setup successful');
} catch (e) {
print('β Exception during setup: $e');
setState(() {
_status = 'Setup failed: $e';
});
}
}
@override
void dispose() {
_connectivitySubscription.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Connectivity Plus Test')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Status: $_status'),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () async {
final result = await Connectivity().checkConnectivity();
print('Single check result: $result');
},
child: const Text('Check Connectivity (Single)'),
),
],
),
),
);
}
}Logs
π΅ Setting up connectivity listener...
======== Exception caught by services library ======================================================
The following PlatformException was thrown while activating platform stream on channel dev.fluttercommunity.plus/connectivity_status:
PlatformException(0, NetworkManager::StartListen, null, null)
When the exception was thrown, this was the stack:
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:367:18)
<asynchronous suspension>
#2 EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:712:11)
<asynchronous suspension>
#3 Stream.handleError.<anonymous closure> (dart:async/stream.dart:923:13)
<asynchronous suspension>
====================================================================================================Flutter Doctor
PS C:\Users\RAHMAN\StudioProjects\sms> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel stable, 3.35.7, on Microsoft Windows [Version 10.0.26200.7019], locale en-US)
[β] Windows Version (11 Home Single Language 64-bit, 25H2, 2009)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[β] Chrome - develop for the web
[β] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.9 (July 2025))
[β] Android Studio (version 2025.1.3)
[β] VS Code (version 1.105.1)
[β] Connected device (4 available)
[β] Network resources
! Doctor found issues in 1 category.
PS C:\Users\RAHMAN\StudioProjects\sms>Checklist before submitting a bug
- I searched issues in this repository and couldn't find such bug/problem
- I Google'd a solution and I couldn't find it
- I searched on StackOverflow for a solution and I couldn't find it
- I read the README.md file of the plugin
- I'm using the latest version of the plugin
- All dependencies are up to date with
flutter pub upgrade - I did a
flutter clean - I tried running the example project