Flutter Package Power: Share Your Creations

Important things about Flutter package development.

Simply create a flutter project. But set the Project Type to package.

Android Studio => New Flutter Project

***

And the project will be created. Here don't have any Android, iOS or other folders. Make a src directory for all files and a [package_name].dart inside the lib folder. Also, make an Example folder. Inside the example folder make a new Flutter application (not package) for the example app.

Inside the [package_name].dart addyour file name and most importantly add

a library declaration. Like this:-

Write readme.md file instruction is given inside the file. Record a short video of your project and convert it to .gif. And set it to readme file. It will be more professional.

Write CHANGELOG as .md method. You can follow this method -

## 1.0.0

* Initial release

## 1.0.1

* add example

## 1.0.2

* some minor changes

Edit the license file. Flutter recommend this https://opensource.org/license/BSD-3-Clause .

BSD 3-Clause License

Copyright (c) 2024, RATUL HASAN RUHAN
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Add your project to GitHub.

Then the most important thing. Add data for the pub.dev.

Optional thing but If you add those. It will be more professional.

Optional

Now, a most important thing. You have to add platforms: on pubspec.yaml otherwise it shows undefined platform on pub.dev.

Most important for show this:


For a better view of pub.dev . Like this-

Just add this on pubspec.yaml. And put your screenshot on it.

screenshots:
  - description: "Example of first page"
    path: example/screenshot/screenshot1.png
  - description: "Example of middle page"
    path: example/screenshot/screenshot2.png
  - description: "Example of final page"
    path: example/screenshot/screenshot3.png

Now the publishing part:

You can create a publisher account (optional). Login with Google on pub.dev .

Now on the project terminal write this command -

dart pub publish

And Done!!

Thanks for reading this whole bunch of things.

1
Subscribe to my newsletter

Read articles from Ratul Hasan Ruhan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ratul Hasan Ruhan
Ratul Hasan Ruhan

Hey, I'm Ratul Hasan Ruhan—a Flutter enthusiast, mobile app developer, and tech blogger. Let's explore the world of Flutter together! 🚀 #MobileDev