Agora-Flutter-SDK icon indicating copy to clipboard operation
Agora-Flutter-SDK copied to clipboard

Undefined name 'platformViewRegistry'

Open peilinok opened this issue 7 months ago • 10 comments

Version of the agora_rtc_engine

6.5.x 6.3.x

Platforms affected

  • [ ] Android
  • [ ] iOS
  • [ ] macOS
  • [ ] Windows
  • [x] Web

Steps to reproduce

https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/pull/2273

Expected results

no error

Actual results

from @arthurbcd

The ui.platformViewRegistry (currently deprecated) will be removed on the next flutter stable release. Which throws: Error: Undefined name 'platformViewRegistry'. The solution is to use dart:ui_web instead of dart:ui, both available in flutter.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

peilinok avatar Apr 24 '25 03:04 peilinok

by @arthurbcd https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/pull/2273

revert in https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/pull/2290

peilinok avatar Apr 24 '25 03:04 peilinok

HI. I got that issue on flutter web 3.32.0 I hope it will be fixed soon

elihaialgoaitech avatar May 21 '25 14:05 elihaialgoaitech

Same here, some plugins used it (flutter_super_html_viewer) and it doesnt work anymore on the web :

html_content_viewer_widget_web.dart:261:8: Error: Undefined name 'platformViewRegistry'.
    ui.platformViewRegistry
       ^^^^^^^^^^^^^^^^^^^^

tototo23 avatar May 27 '25 12:05 tototo23

I think i found a solution. Simply change import dart:ui as ui; to import 'dart:ui_web' as ui; in /lib/src/impl/platform/web/global_video_view_controller_platform_web.dart Not sure why this does not cause any problems before.

working on PR

maple135790 avatar May 28 '25 02:05 maple135790

As mentioned in #2290

This has been fixed before, but sadly, since the separation of dart:ui and dart:ui_web was introduced in flutter 3.13.0, this fix won't meet the bottom requirement 3.0.0.

For users on ^3.32.0, following the fix in 77b68ae358973d47b49e15ac06ab9ae60cba05b4 and saving it locally should work.

maple135790 avatar May 28 '25 03:05 maple135790

@maple135790 Thank you very much for your summary. We will schedule an upgrade for compatibility versions and fix this issue in the near future.

peilinok avatar May 28 '25 03:05 peilinok

As mentioned in #2290

This has been fixed before, but sadly, since the separation of dart:ui and dart:ui_web was introduced in flutter 3.13.0, this fix won't meet the bottom requirement 3.0.0.

For users on ^3.32.0, following the fix in 77b68ae and saving it locally should work.

Hi @elihaialgoaitech @tototo23 , If you need to work with the latest Flutter version, we recommend forking a private repository and cherry-picking the fix commit as a temporary solution. We will notify you once we complete the compatibility upgrade in our main repository.

peilinok avatar May 28 '25 03:05 peilinok

Hello, we've had this problem for a long time, on every build we have to change dart:ui_web manually. When do you have a plan to change it in your main repository??

Qpace-Team avatar Jun 29 '25 09:06 Qpace-Team

"we recommend forking a private repository and cherry-picking the fix commit as a temporary solution"

Which one? From where?

JasonHoku avatar Jul 03 '25 22:07 JasonHoku

This issue needs to be fixed on Agora's side ASAP. I'm not going to pay for a service that requires a patchy workaround to use.

MrPatben8 avatar Jul 09 '25 18:07 MrPatben8