plus_plugins
plus_plugins copied to clipboard
[Bug]: connectivity_plus connection is none after iOS phone language change
Platform
iOS 16.4
Plugin
connectivity_plus
Version
3.0.3
Flutter SDK
3.7.7
Steps to reproduce
- flutter create --platforms=ios reachability
- cd reachability
- flutter pub add connectivity_plus
- replace lib/main.dart content with the provided
- flutter run --release
- turn on wifi and open test application: both results should be wifi
- send app into the background
- open phone's setting application and select a different language in the General - Language & Region menu.
- switch back to the test app by the app switcher gesture
After switching back, both results (one queried in main and one in a stateful's widget initState) will be none
, even thought nothing changed in the network. After a little while if you press the Check
button, then it will say wifi
.
I downloaded the native ReachabilitySwift example app and that doesn't do it on the same phone, it says Wifi
after language change too.
As I see connectivity_plus
installs only 5.0.0
of ReachabilitySwift
, not 5.1.0
(at least in the Podfile.lock
I see that), but that may not matter in this case.
Code Sample
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final result = await Connectivity().checkConnectivity();
runApp(MyApp(result: result));
}
class MyApp extends StatelessWidget {
final ConnectivityResult? result;
const MyApp({super.key, this.result});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Reachability test'),
),
body: Column(
children: [
Text('Passed result: $result'),
const MyHomePage(),
],
),
),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
ConnectivityResult result = ConnectivityResult.none;
@override
void initState() {
super.initState();
_checkConnection();
}
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Result: $result'),
ElevatedButton(
onPressed: () => _checkConnection(), child: const Text('Check')),
],
),
);
}
void _checkConnection() {
Connectivity()
.checkConnectivity()
.then((value) => setState(() => result = value));
}
}
Logs
No logs as it possible only in release mode. Language switch kills the app, so I don't know how and what would I log.
Flutter Doctor
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.3 22E252 darwin-x64, locale hu-HU)
• Flutter version 3.7.7 on channel stable at /Users/webtown/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2ad6cd72c0 (4 weeks ago), 2023-03-08 09:41:59 -0800
• Engine revision 1837b5be5f
• Dart version 2.19.4
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Volumes/MacMiniExternal/Android/sdk
• Platform android-33, build-tools 33.0.1
• ANDROID_HOME = /Volumes/MacMiniExternal/Android/sdk
• ANDROID_SDK_ROOT = /Volumes/MacMiniExternal/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.77.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (3 available)
• WTiPhone11 (mobile) • 00008030-000129222140802E • ios • iOS 16.4 20E247
• macOS (desktop) • macos • darwin-x64 • macOS 13.3 22E252 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.146
! Error: WTiPhone11 is busy: Fetching debug symbols for WTiPhone11. Xcode will continue when WTiPhone11 is finished. (code -10)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Checklist before submitting a bug
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with
flutter pub upgrade
- [X] I did a
flutter clean
- [X] I tried running the example project
I also found this bug in my app. Probably users are not changing their language very often, but still, it gives a bad user experience. Any news about some fix?
Any fixes? I also facing an issue
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Any fixes? I also facing an issue
Update on this?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days