Publish flutter package to pub.dev

precondition

  1. The package code is uploaded to Github
  2. Have Google Gmail

Pubspec. yaml information needs to be improved before publication.

Author: nickname < [email protected] > # homepage githup project address homepage: https://github.com/XXX/flutter_subscreen_pluginCopy the code

Next, commit, the command line executes:

$ flutter packages pub publish --server=https://pub.dartlang.org
Copy the code

Select Y and click the link to Google to verify.

Error:

It looks like accounts.google.com is having some trouble.
Copy the code

The network wall overflows. Enter the following statement on the command line:

Export http_proxy = http://127.0.0.1:1087; Export https_proxy = http://127.0.0.1:1087;Copy the code

Then execute again:

flutter packages pub publish --server=https://pub.dartlang.org 
Copy the code

The terminal sends an error message:

The LICENSE file cannot be empty. We add the following information:

Copyright © 2021, llixiaohong
All rights reserved.

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

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

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.

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.
Copy the code

After the supplement is finished, go through the process command again, as shown below, it is successfully uploaded, and it can be used after the server there is updated again (about 1 hour)

What is the address posted to pub?

#https://pub.flutter-io.cn/packages/ plugin name, example https://pub.flutter-io.cn/packages/flutter_subscreen_pluginCopy the code

If you need to upgrade the version number for later maintenance, repeat the operations published above.