Coder Social home page Coder Social logo

PlatformException (PlatformException(channel-error, Unable to establish connection on channel., null, null)) on Android devices about flutter HOT 5 CLOSED

EMUNES avatar EMUNES commented on June 8, 2024
PlatformException (PlatformException(channel-error, Unable to establish connection on channel., null, null)) on Android devices

from flutter.

Comments (5)

EMUNES avatar EMUNES commented on June 8, 2024 1

Sure. I found that this issue only occur if shared_preferences is used with flutter_quill. Using shared_preferences with other dozens of packages in our project all works well. I will first check super_clipboard that flutter_quill depends on, which uses Platform Specific Configurations. If I find other problems, I will report.

from flutter.

huycozy avatar huycozy commented on June 8, 2024

Hi @EMUNES
Your sample code above is production code and it's unclear which plugin is causing the issue. You should narrow down the issue by removing the usage of 3rd party plugins/packages one by one, unrelated/unaffected pages, and isolating the affected page into a minimal sample code that can produce the issue. And please share it here when you have such an example. Thanks!

from flutter.

EMUNES avatar EMUNES commented on June 8, 2024

Thanks @huycoz. I never thought a plugin can cause this big trouble to the project. Taking your suggestion, I can reproduce the exception if I had flutter_quill in my project. The exception persists from flutter_quill 9.0.0 to newest 9.3.10 version. The minimal example is as follows:

the minimal dependency in pubspec.yaml

name: fix
description: "A new Flutter project."
publish_to: "none"
version: 1.0.0+1

environment:
  sdk: ">=3.3.4 <4.0.0"

dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^2.2.3 # Persistent settings.
  flutter_quill: "9.0.0"

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

the minimal production code to run

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final prefs = await SharedPreferences.getInstance();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

It looks like I have found the problem. Everything was fine before, it could be flutter pub upgrade certain dependencies under flutter_quill. Maybe I should raise an issue there?

from flutter.

huycozy avatar huycozy commented on June 8, 2024

Well, since you left shared_preferences in the sample code above, I re-checked this using its package example but couldn't reproduce the issue.

I think it may not issue of flutter_quill because I don't see it has platform implementation (it's a normal package as I can see) but it could be caused by a plugin that it's depending on, see its Platform Specific Configurations.

So, if the issue appears when you only import and use flutter_quill package, you should report the issue on its repository for better support there. In case you can narrow it down and find something new that you think this is a Flutter 1st party package bug, please write in comments.

from flutter.

EMUNES avatar EMUNES commented on June 8, 2024

It's a package issue related to rust language recent changes. Fixed by irondash/irondash#51.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.