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

[Question]: Is generated_plugin_registrant.dart necessary for web for device_info_plus and package_info_plus? #1274

Closed
7 tasks done
naamapps opened this issue Oct 19, 2022 · 13 comments
Labels
question Further information is requested

Comments

@naamapps
Copy link

What is your question?

Hey,
After upgrading device_info_plus and package_info_plus to latest versions,
the generated_plugin_registrant.dart file does not generate the PackageInfoPlugin.registerWith(registrar); and DeviceInfoPlusPlugin.registerWith(registrar); lines anymore (It used to generate those lines, so after upgrading I had this error

Undefined name 'PackageInfoPlugin'.
Try correcting the name to one that is defined, or defining the name

Is this the right behaviour?

Thanks.

Checklist before submitting a question

  • 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 am 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
@naamapps naamapps added the question Further information is requested label Oct 19, 2022
@miquelbeltran
Copy link
Member

Looks related to #1270

@miquelbeltran
Copy link
Member

Please check if with the latest release of the package(s) still happens

@naamapps
Copy link
Author

Hey @miquelbeltran,
Still won't generate for me.

I think this line is the culprit

if (dart.library.html) 'src/device_info_plus_web.dart';

If I try to write DeviceInfoPlusWebPlugin manually inside the generated_plugin_registrant file, it won't recognize this class.

@naamapps
Copy link
Author

Same for PackageInfo.

@miquelbeltran
Copy link
Member

mhh, so adding the export for the web plugin implementation causes the generated_plugin_registrant not to work properly? If you can checkout the project locally, reference by path, and then find what causes it, it will be super helpful (also feel free to submit a PR if you find the solution).

@miquelbeltran
Copy link
Member

Just for the record, if I add package_info_plus, device_info_plus and connectivity_plus to a project, run it as web app, I see no problems running it, calling to the plugins, and the web_plugin_registrant.dart seems correct to me.

@naamapps
Copy link
Author

Is the file web_plugin_registrant the same as generated_plugin_registrant?
I can't find it in my project at all..

I tried deleting the generated_plugin_registrant file and it didn't even regenerate itself.

@miquelbeltran
Copy link
Member

It is in .dart_tool/dartpad/web_plugin_registrant.dart it appears for me when running the project

@naamapps
Copy link
Author

Found it! And it does generate correctly for all packages.
So what is the generated_plugin_registrant file that was in my project? Is it not relevant anymore?

@miquelbeltran
Copy link
Member

I remember that the generated_plugin_registrant.dart is generated when running on web, but I guess this was changed eventually.

Do you still have problems running the project on web with the latest release?

@naamapps
Copy link
Author

Nope, all good.
Thanks.

@MrCsabaToth
Copy link

Wait, that whole file generated_plugin_registrant.dart in my app's lib folder is not needed any more?

MrCsabaToth added a commit to TrackMyIndoorWorkout/TrackMyIndoorWorkout that referenced this issue Oct 31, 2022
…r web anyway.

Problem after package_info_plus and device_info_plus updates: the generated_plugin_registrant.dart which is for web platform does not compile (package:device_info_plus_web/device_info_plus_web.dart and package:package_info_plus_web/package_info_plus_web.dart does not exist any more). See also fluttercommunity/plus_plugins#1274
@anushka-mim
Copy link

I have two files generated_plugin_registrant.cc and generated_plugins.cmake in both windows and linux folders when I build my project for the web. And they keep showing under git changes. How do I stop these files from regenerating?

LuchoTurtle added a commit to dwyl/visual-editor that referenced this issue Sep 11, 2023
LuchoTurtle added a commit to dwyl/visual-editor that referenced this issue Sep 11, 2023
- Updated `i18n_extensions` and fixed gradle files to make it run. Also repaired iOS files (podfile) so the example app could run.
- Updated `image_picker`
- Updated `string_validator`
- Upgraded `device_info_plus`. With this upgrade, also updated the `file_picker` on the example app otherwise dependency versioning wouldn't work. Also deleted the generated `generated_plugin_registrant.dart`, as it's not needed. See fluttercommunity/plus_plugins#1274.
- left `pedantic` on, even though `flutter_lint` is the default way now. This is because I don't know the exact rules and if this was desirable for your team.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants