DartPad makes it easy to share your Dart & Flutter samples using GitHub gists.
Here's how to do it in three steps.
10x your Flutter productivity. Use FlutterFlow's visual builder to generate clean Flutter code and take your Flutter productivity to the next level. FlutterFlow comes with Flutter + Firebase integration, custom code extensibility, web app + multi-language support, and one-click deploy enabling you to ship apps faster than ever.
If you're starting directly from Dartpad, you can skip this step since you'll already have all your code in one file.
But if you have a local Dart or Flutter project, you'll want to put all your code inside
Head over to gist.github.com to create a new gist with all your code:
Once you've done this, you can already share your gist by sharing the URL with everyone.
But it's even better if you turn it into a DartPad!
All you have to do is to copy the gist ID:
Then, open dartpad.dev and append the gist ID to the URL.
This will load your code and let you run it as usual:
Did you know that you can import popular packages directly inside DartPad?
Just click on the small info button in the lower right corner and you'll get a list of supported packages, along with their versions:
You can easily embed your DartPad on your site using an iframe.
For example, here's how I use it in my online courses:
<iframe width="100%" height="800px" src="https://dartpad.dev/embed-flutter.html?&split=50&theme=dark&id=408331308d26bdbb3361ecb98a50bd12"></iframe>
For a full list of options, see the Embedding Guide on the DartPad Wiki.
DartPad + GitHub gists gives you a convenient way to share small Dart or Flutter examples, and you can even embed them on your site.
For larger projects, you can just create a public GitHub repo as usual.
In any case, sharing is caring! 😉