In the previous article, we saw how we can create Custom AppBar now what if we want to publish that package or any other plugin on Dart Pub so that you can give something to the Flutter Community.😁

Package and Plugin both are different I’ll explain that in detail in some other article.

Some personal opinion:

If as a developer you ever think that any of your package or plugin can be useful to the community please give do try to use Dart pub to share it.

I’m going to make this article short and sweet so let’s start...

First and foremost thing is to add package details like name(obviously), description, author, homepage(link to your Github repo) and most importantly the version in pubspec.yaml

name: custom_top_bar description: Custom AppBar version: 0.0.2 author: Ketan Choyal <ketanchoyal@gmail.com> homepage: https://github.com/ketanchoyal/custom_top_bar

Note 1: Always document your package or plugin (using READ.md) including an example implementing this package or plugin so that developers can easily implement your code.

Note 2: Any changes in the package should be logged in CHANGELOG.md file.

Now comes the climax:

Step 1: Using terminal go to the package folder. Step 2: run the following command:

pub publish --dry-run

This command will check if all the requirements are fulfilled or not.

Let’s try to create a warning for a better explanation:

Here I forgot to fill some fields like author and homepage…

Step 3: Finally after debugging all the errors run the same command without ‘ — dry-run’

pub publish

Just the authorization process and your package will be published.

So yeah, you have finally published your package and gave something to the Flutter community.

Now if you want to update your package follow these same process and now your package is updated on Dart pub.

Again I’m new too in this community so if anything is wrong please do let me know.