Creating own Dart packages
But it’s still possible that you need a package to share between your projects and you can’t find a good enough one or just don’t want to rely on a external package for many reasons, and because of that I want to talk about creating your own package.
So let’s create the project using the command like the image below, because this is how we create a package.
And if everything went well, you probably have something like this.
Now if your got curious, you probably took a look at the code inside the lib folder and saw just a increment function, but I’ll do a little thing to improve the package usage, and for this I’ll just export one file with the Calculator class witch contains the sample code.
In my case I created a Github repository and pushed the created project as the image bellow.
Now it’s time to use it. And for better understanding I’ll use the counter app just to continue incrementing it.
And as the result we have something like the gif below.