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

code parameter couldn't be applied to dartpad, Live demo is also broken. #6

Open
burcugen opened this issue Mar 11, 2024 · 6 comments

Comments

@burcugen
Copy link

burcugen commented Mar 11, 2024

Hello,

Dartpad widget didn't show the code that we passed as parameter, It shows the default code snippet.
You can replicate the issue, by simply visiting the dart_pad live demo.

Dartpad now opened with the default code.
void main() { for (int i = 0; i < 10; i++) { print('hello ${i + 1}'); } }

How can we fix this?
Maybe the issue is related with this dartpad issue

Thanks in advance.
Best, Burcu.

@TimWhiting
Copy link
Owner

Here is the most relevant info:
https://github.com/dart-lang/dart-pad/wiki/Embedding-Guide#embedding-choices (i.e. the injection method I was using seems to be deprecated).

The new format is probably closer to what you linked: dart-lang/dart-pad#2702. Here is the new documentation on the recommended way to inject: https://github.com/dart-lang/site-shared/tree/main/packages/inject_dartpad, and that is probably where I'd start . I'm not sure if it supports all of the varieties as before, but I'm happy to take a look at a PR if you want to give it a go. There really isn't much in this library since it is just a simple wrapper around a HTML platform view.

@fvisticot
Copy link

I have the same issue to display and execute flutter code in the dartpad. Is it planed to update the widget ? It would be awesome !

@TimWhiting
Copy link
Owner

Fixed it by switching to an old dartpad url for now. The new embedding doesn't support all of the same options as before, and so it will take longer to figure out how best to evolve this package. Eventually I will migrate to the new embedding, since it should be much faster (doesn't use iframes).

@burcugen
Copy link
Author

burcugen commented May 5, 2024

Hi @TimWhiting , Thanks for the update. Today, I want to update the library for my project for checking in. But I got the following error on the library file. Is there anything that I'm missing, I'm trying to run this for flutter 3.10.6. My current configuration as follows.

Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
../../../.pub-cache/hosted/pub.dev/dart_pad_widget-2.2.1/lib/dart_pad_widget.dart:145:8: Error: Undefined name 'platformViewRegistry'.
    ui.platformViewRegistry
       ^^^^^^^^^^^^^^^^^^^^
Failed to compile application.

My flutter config as follows:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 14.3.1 23D60 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.89.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Screenshot 2024-05-05 at 9 15 05 PM

@TimWhiting
Copy link
Owner

Try pinning this package to the version 2.1.1 which will work on old versions of flutter if you cannot update your flutter sdk.

@burcugen
Copy link
Author

burcugen commented May 5, 2024

Thanks for the help, I was able to run the 2.1.1 version with Flutter 3.19.0 sdk with success. 🚀🎉

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

3 participants