Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No implementation found for method getAll on channel dev.fluttercommunity.plus/package_info #1270

Closed
7 tasks done
CodeDoctorDE opened this issue Oct 19, 2022 · 25 comments · Fixed by #1275
Closed
7 tasks done
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest linux package_info_plus stuff related to package_info_plus

Comments

@CodeDoctorDE
Copy link

Platform

Linux (Fedora 36)

Plugin

package_info_plus

Version

3.0.0

Flutter SDK

3.3.4

Steps to reproduce

  1. Upgrade to the latest package_info_plus 3.0.0
  2. Use await PackageInfo.fromPlatform()

After downgrading to 2.0.0, everything works.

I cloned the example from the main branch and everything works there.

Code Sample

Future<bool> hasNewerVersion() async {
    final packageInfo = await PackageInfo.fromPlatform();
    return packageInfo.version != kVersion;
}
const kVersion = "1.0.0";

Logs

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel dev.fluttercommunity.plus/package_info)
#0      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:294
<asynchronous suspension>
#1      MethodChannel.invokeMapMethod
package:flutter/…/services/platform_channel.dart:499
<asynchronous suspension>
#2      MethodChannelPackageInfo.getAll
package:package_info_plus_platform_interface/method_channel_package_info.dart:13
<asynchronous suspension>
#3      PackageInfo.fromPlatform
package:package_info_plus/package_info_plus.dart:41
<asynchronous suspension>
#4      SettingsCubit.hasNewerVersion
package:butterfly/cubits/settings.dart:424
<asynchronous suspension>
#5      _ProjectPageState._showIntroduction
package:butterfly/views/main.dart:216
<asynchronous suspension>

Flutter Doctor

[✓] Flutter (Channel stable, 3.3.4, on Fedora Linux 36 (Workstation Edition) 5.19.15-201.fc36.x86_64, locale de_DE.UTF-8)
    • Flutter version 3.3.4 on channel stable at /home/jan-andrej/Tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (vor 2 Wochen), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/jan-andrej/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at:
      /home/jan-andrej/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.5 (Fedora 14.0.5-1.fc36)
    • cmake version 3.22.2
    • ninja version 1.10.2
    • pkg-config version 1.8.0

[✓] Android Studio (version 2021.3)
    • Android Studio at /home/jan-andrej/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335
    • 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)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
    • IntelliJ at /home/jan-andrej/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14
    • Flutter plugin version 70.2.5
    • Dart plugin version 222.4345.14

[✓] VS Code (version 1.72.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.50.0

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Fedora Linux 36 (Workstation Edition) 5.19.15-201.fc36.x86_64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Checklist before submitting a bug

  • 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
@CodeDoctorDE CodeDoctorDE added bug Something isn't working triage labels Oct 19, 2022
@san-smith
Copy link

I have the same problem.

Platform
Linux (Linux Mint 20.2)

Plugin
package_info_plus

Version
3.0.0

Flutter SDK
3.3.4

@miquelbeltran
Copy link
Member

I cannot reproduce the error.

Steps:

  1. Create new project with flutter create error_1270
  2. Add plugin with flutter pub add package_info_plus
  package_info_plus: ^3.0.0
  1. Add call to PackageInfo.fromPlatform()
    final packageInfo = await PackageInfo.fromPlatform();
    print(packageInfo.appName);
  1. Run project on Linux.
  2. Log appears correctly:
flutter: error_1270

@san-smith
Copy link

I am also got a similar error with device_info_plus:

UnimplementedError (UnimplementedError: linuxInfo() has not been implemented.)

Platform
Linux (Linux Mint 20.2)

Plugin
device_info_plus

Version
7.0.0

Flutter SDK
3.3.4

@nohli
Copy link
Member

nohli commented Oct 19, 2022

@CodeDoctorDE @san-smith can you please share the whole file where it crashes, or at least the imports? Thanks!

@miquelbeltran
Copy link
Member

Can you confirm that you have done a proper flutter clean and pub upgrade?

@CodeDoctorDE
Copy link
Author

I did.
I ran the example in the repo and it works. Only on my project it happens

@CodeDoctorDE
Copy link
Author

grafik
on my package_info_plus folder there is no linux folder

@nohli
Copy link
Member

nohli commented Oct 19, 2022

@CodeDoctorDE
Can you please try flutter clean and flutter pub upgrade?
And I meant the imports in the Dart-file where the failing method is called. Please share as well 🙂

@CodeDoctorDE
Copy link
Author

CodeDoctorDE commented Oct 19, 2022

i did it already.
This is the line: https://github.com/LinwoodCloud/Butterfly/blob/a3f3fa5142d1040b189f2e07ac2096d4a48799ec/app/lib/cubits/settings.dart#L424
Why does the error happen if there is no method call on linux?

@miquelbeltran
Copy link
Member

The Linux implementation of the plugin is in the src/package_info_plus_linux.dart file.

The pubspec.yml is configured to use this class as the Linux implementation:

        dartPluginClass: PackageInfoPlusLinuxPlugin

For some reason, it seems that something is not being generated correctly for some users, and so Flutter/Dart is not linking to the correct implementation class.

@miquelbeltran
Copy link
Member

i did it already. This is the line: https://github.com/LinwoodCloud/Butterfly/blob/a3f3fa5142d1040b189f2e07ac2096d4a48799ec/app/lib/cubits/settings.dart#L424

I see that on this branch, the package_info_plus is still at v2.0.0

Do you have an up-to-date branch of the project using 3.0.0?

@CodeDoctorDE
Copy link
Author

I pushed the update-dependency branch a few seconds ago.
The problem only happens on runtime, I will try out the build artifacts.

I wanted to test it on my machine before pushing the upgrade.

@miquelbeltran
Copy link
Member

I pushed the update-dependency branch a few seconds ago. The problem only happens on runtime, I will try out the build artifacts.

I wanted to test it on my machine before pushing the upgrade.

I will check your code if you don't mind. Can you specify the step by step to run the app and reproduce the issue? Currently trying to run your app but it fails as it tries to write to /usr/local/butterfly which I prefer no to :)

@CodeDoctorDE
Copy link
Author

Thanks.
You need libjsoncpp-dev and libsecret on your pc.
Then you can run flutter run -d linux in the app directory.

The error happens in the settings dialog in the update card.

The write is a common problem in flutter. A simple flutter clean should help,

@miquelbeltran
Copy link
Member

yep, that helps! I am able to reproduce the error

@miquelbeltran
Copy link
Member

My only finding is that inside .dart_tool/flutter_build/dart_plugin_registrant.dart the call to PackageInfoPlusLinuxPlugin.registerWith(); is missing.

While it does exist on my project I created from scratch.

The call to register PackageInfoPlus plugins is for Windows. But the Linux one is missing 🤔

@miquelbeltran
Copy link
Member

miquelbeltran commented Oct 19, 2022

I am completely lost and can't understand why the dart_plugin_registrant.dart is not being correctly generated on your project.

It does work for me when I create a project from scratch, or as you say, when you run the example in this repo. But in your project the call to PackageInfoPlusLinuxPlugin.registerWith() is missing, and even running with --verbose doesn't show any errors.

The only action I can think of is to submit an issue on the flutter/flutter project explaining this.

And meanwhile to use the 2.0.0 version.

(or call to PackageInfoPlusLinuxPlugin.registerWith(); manually, but that's basically a hack so DO NOT DO IT)

@miquelbeltran miquelbeltran added package_info_plus stuff related to package_info_plus linux Hacktoberfest Issues taking part in Hacktoberfest and removed triage labels Oct 19, 2022
@san-smith
Copy link

@miquelbeltran

Could this be due to the fact that my project does not have full null safety support?

File dart_plugin_registrant.dart in my project have // @dart = 2.9 annotation.

@miquelbeltran
Copy link
Member

Here's a fun thing: If I add connectivity_plus to my project, then I have the same error and the PackageInfoPlusLinuxPlugin.registerWith() is missing from the dart_plugin_registrant.dart, but the ConnectivityPlusLinuxPlugin.registerWith(); appears.

Doing more research....

@san-smith
Copy link

It's curious.
My project also has connectivity_plus. While I used package_info 2.0, there were no problems, and with the transition to 3.0 the same behavior in dart_plugin_registrant.dart

@miquelbeltran
Copy link
Member

We changed the architecture from federated packages to a one where all the implementations are in the same package. That may be causing an issue. However, the packages work fine standalone but not together. My only explanation is that there's something weird in how the Flutter/Dart compiler works.

This issue may be affecting other packages outside the plus_plugins ecosystem, as @nohli for example today told me that he had a similar error with path_provider I believe it is caused by the same issue.

@miquelbeltran
Copy link
Member

Feel free to thumbs up and add any relevant comments to flutter/flutter#113720

@iqfareez

This comment was marked as off-topic.

@miquelbeltran
Copy link
Member

Releases fixing the registration code generation are published now, please let me know if that fixes the issue.

@CodeDoctorDE
Copy link
Author

It works, thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest linux package_info_plus stuff related to package_info_plus
Projects
None yet
5 participants