How to Easily Share Dart & Flutter Code

Published

It’s a bit of a pain to actually need to share or send code so that someone else can run it. There’s an easy way to actually sidestep the issue and make it dead simple when it comes to both Dart & Flutter code.

For this you’ll need to have a Github account and head over to Gist.

You’ll just need to save your script, give it a filename finishing with .dart and don’t forget to add a short description explaining your code before saving it.

For the tricky part, I’ll be explaining using one of my older gist scripts which can be found in this gist.

You’ll need to look at the gist’s URL (for mine it’s https://gist.github.com/MBeliou/e73e2b9d43835de0439ec9266356a89f) and copy the part right after your username.

In my case it’s going to be e73e2b9d43835de0439ec9266356a89f.

Then head over to dartpad and just copy your identifier at the end of the url.

For my script, it’s simply going to be https://dartpad.dartlang.org/e73e2b9d43835de0439ec9266356a89f.

And voilà, you’re done. You can share this link with anyone around the world that might need access to your code and run it.