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

The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it from dart:ui_web instead. #73

Closed
tushar0518 opened this issue Jan 13, 2024 · 7 comments

Comments

@tushar0518
Copy link

tushar0518 commented Jan 13, 2024

I'm getting the below warning when using the dropzone package. @deakjahn

Warnings:
The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it from dart:ui_web
instead.
The webOnlyAssetManager getter is deprecated and will be removed in a future release. Please use assetManager from
dart:ui_web instead.

Possible Fix: change this import => import 'dart:ui' as ui; to import 'dart:ui_web' as ui; throughout the project

Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.7, on macOS 13.3 22E252 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.85.1)

@JorgeBrandao1980
Copy link

Good morning.
I have exactly the same problem, have you found a solution yet?
Thank you.

@tushar0518
Copy link
Author

Good morning. I have exactly the same problem, have you found a solution yet? Thank you.

not at the moment, if only the author of the plugin should make the changes and release a new version.

deakjahn added a commit that referenced this issue Jan 26, 2024
@deakjahn
Copy link
Owner

@tushar0518 Yes, yes, I hear. But this is always a double edged sword. Flutter introduces something new and deprecates the old one. People who upgrade their Flutter immediately are annoyed by the warning. But other people who don't upgrade might find their existing, functioning plugins suddenly broken. It's always a tough decision to determine how long to wait. Now that we moved, we might get an influx of angry people reporting that the plugin no longer works for them just because they still use a Flutter version of a year ago. :-))

@ztaylor54
Copy link

<...> we might get an influx of angry people reporting that the plugin no longer works for them just because they still use a Flutter version of a year ago. :-))

@deakjahn here with my pitchfork 😅

This is a non-issue with proper use of version constraints in your pubspec.yaml. At the very least, it should be a new major version, which would indicate a breaking change and prevent a flutter pub upgrade from upgrading versions automatically (hence why I'm here). See this stack overflow answer for more context / info.

The release notes for 3.13.0 show the addition of the deprecation message to the dart:ui package, so you'd probably be OK updating the pubcpec.yaml with:

environment:
  sdk: ">=2.12.0 <4.0.0"
  flutter: ">=3.13.0"

The temporary workaround on my end (and for anyone else who comes across this) is to override the version for flutter_dropzone_web in pubspec.yaml:

dependency_overrides:
  flutter_dropzone_web: <=3.0.12

or upgrade to a version of flutter >= 3.13.

@deakjahn
Copy link
Owner

Yes, for serious changes, for sure. But to create a major version change for something as small as a deprecation, well. :-)

@ztaylor54
Copy link

@deakjahn I would agree if it were just a deprecation - but your change depends on dart:ui_web:

dart:ui_web was introduced in Flutter version 3.10.0 (see the release notes and PR) and platformViewRegistry wasn't moved into ui_web until version 3.13.0 (see my above comment), but the pubspec.yaml only requires >=1.17.0:

This is a breaking / major change if you don't keep your version constraints up-to-date. In fact, this package is currently broken for any news users that don't have at least flutter version 3.13.0 installed. It causes the following compilation error:

../../../../.pub-cache/hosted/pub.dev/flutter_dropzone_web-3.0.13/lib/flutter_dropzone_plugin.dart:27:8: Error: Undefined name 'platformViewRegistry'.
    ui.platformViewRegistry.registerViewFactory(
       ^^^^^^^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/flutter_dropzone_web-3.0.13/lib/flutter_dropzone_plugin.dart:33:26: Error: Undefined name 'assetManager'.
    final scriptUrl = ui.assetManager.getAssetUrl(

You should at the very least update the pubspec.yaml to include the proper constraints in the next release.

deakjahn added a commit that referenced this issue Feb 19, 2024
@deakjahn
Copy link
Owner

deakjahn commented Feb 20, 2024

@ztaylor54 I added it. The reason I'm a bit unwilling to make it a breaking change right now is that a new version is in the works (see #76) that we're forced to do, anyway, because of underlying changes in Flutter. And that will be a breaking change and a new major version for sure*. Unfortunately for us, Flutter is doing very active work in this department now and this makes it a bit of a moving target. Also, I have the feeling that this new approach with the web package in not as mature yet as the Flutter team makes it out to be. I'm afraid we'll have some serious bumps on this road, no matter what.

(* In hindsight, we could have postponed this change here until that new version but unfortunately, the timeline was different, this change was already done when the new issue emerged.)

This new change will have much more serious implications, as consumers will need to move on to the new package as well, so this will really warrant a new major version. But developers lagging behind the current Flutter version, well... As I mentioned above, I'm never really comfortable doing it right away, but four or five months after the actual upgrade came out, well, I'm inclined to think that everybody should already be moving along. At any rate, modifying the constraint is absolutely warranted, sure.

I made a pinned issue now for people arriving with the old version, also mentioning that a new version will be out later.

deakjahn added a commit to dxvid-pts/flutter_dropzone that referenced this issue Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants