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

Dynamic adding a plugin #2697

Closed
rekire opened this issue Oct 29, 2023 · 5 comments
Closed

Dynamic adding a plugin #2697

rekire opened this issue Oct 29, 2023 · 5 comments
Labels
area-packages type-question A question about expected behavior or functionality

Comments

@rekire
Copy link

rekire commented Oct 29, 2023

At first I'm aware about Package and plugin support. I'm wondering if I can use dart-pad as a live preview of my plugin I'm planning to publish soon.

It seems that this is not possible out of the box, but is there a trick I could use? (By side to put all my classes into the sample code)

@johnpryan johnpryan added type-question A question about expected behavior or functionality area-packages labels Jan 8, 2024
@johnpryan
Copy link
Contributor

DartPad doesn't support arbitrary packages right now, you can learn more about how package support works on this page: https://github.com/dart-lang/dart-pad/wiki/Package-and-plugin-support

@Levi-Lesches
Copy link

I think they were asking about hosting a DartPad box on their own site, pre-loaded with their own package. So not adding to the official DartPad site or for all DartPad users, but it could be useful on sites like https://riverpod.dev/ to be able to add any, eg, Riverpod packages to the DartPads on their site for readers to play around with, without petitioning for official approval.

@johnpryan
Copy link
Contributor

Right now, DartPad compiles user code on the server, which uses a Dart/Flutter project with a pubspec.yaml file with all of the supported packages listed in the dependencies section. So this issue sounds to me like it's asking for any package on pub.dev to be supported, but I might be missing something here.

There are already packages that have forked this repo and hosted their own version (For example, https://docs.hivedb.dev) , but we don't maintain instructions since it's a somewhat involved process.

@Levi-Lesches
Copy link

Again, could be wrong, but I believe they mean by providing the source of the code itself, not just "any package on Pub". It can probably be implemented as "include this package's Dart files to be compiled, but hide it from the UI's main.dart and allow the user's code to import it". Importing this package can then be done using a pubspec dependency_override path dependency. There's the problem of what packages can that package import... probably keep it to any package already allowed on DartPad today.

If that's a security concern that makes sense, but in principle it's just like the user entering all that code by hand, or all the code being at the bottom of main.dart.

@rekire
Copy link
Author

rekire commented Feb 1, 2024

My intent was just to let the developer play with my plugin without setting up a new project locally. DartPad looks like perfect for that use case. On the other hand as I wrote initially in my feature request I am aware for the normal process and I don't think that it is necessary to become one of that exclusive packages.

Also the point from Levi was already in my mind I could put everything in my main.dart, but that feels like a very dirty hack which I would like to avoid. Right now I'm thinking that I compile simply my example app for web and embedded it via <iframe>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-packages type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

3 participants