This error is not about firebase. Both shared_preferences and path_provider packages will report this error. This exception only appears on Android devices (both emulators and real devices). When building on Windows11, everything is normal. This exception troubles me because it suddenly occurs when I upgrade to flutter 3.19.6 and flutter upgrade some packages. All my codes should be normal:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await ConfigService().initConfigurations();
await DataStore().initDB();
MediaKit.ensureInitialized();
runApp(const ProviderScope(child: MyApp()));
}
Future<void> initConfigurations() async {
prefs = await SharedPreferences.getInstance();
}
Future<void> initDB() async {
final dir = await getApplicationDocumentsDirectory();
}
ERROR:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
It will be so good if anyone has clues to solve this problem. It came suddenly and I can no longer dev on Android since.
I have tried flutter pub outdated, flutter pub upgrade outdated_package, flutter clean, flutter pub get then flutter run. Those just won't work.