How to change uploader of flutter package - flutter

I have uploaded a package with an email and then I changed to another email. So in order to replace email I've added by using pub uploader add yyyy#gmail.com. and when I try to remove old email it displays the following error
pub uploader remove xxxxxxxxxxx#gmail.com
Self-removal is not allowed. Use another account to remove this email address.
for this issue I searched to fix and found deleted .pub_cache/credentials.json will resolve but I cannot found that file in .pub-cache directory. I want to how to remove old email.

I found answer by myself. Since there is no options like select uploader or logout pub authentication, we need revoke authentication in google. So that while publishing the package it will ask for authentication and that time we can provide new email. Let me explain all these.
First I uploaded a package to pub.dev by using xxxxx#gmail.com but I want to change to yyyyy#gmail.com. So inorder to do this, we have to add yyyyy#gmail.com to the package first. To do that
pub uploader add yyyyy#gmail.com
After adding in web browser go to my
account.google.com -> security -> manage third party access -> remove pub.dartlang.org.
after revoking access to old account in terminal publish the package again and it will ask for authentication, now login with yyyyy#gmail.com and then type
pub uploader remove xxxxx#gmail.com
Now changed the publisher successfully.

Right now the steps you mention above are generating the following error: {"code":"MissingAuthentication","message":"authenication is required, please add authorization header."}
For an updated approach do the following:
Add the new uploader with flutter pub uploader add <new_email#email.com>
Remove the previous uploader with flutter pub uploader remove <previous_email#email.com>
Remove saved credentials using flutter pub logout or rm ~/Library/Application Support/dart/pub-credentials.json.
Finally type flutter pub publish and allow access from your navigator.
Source:
"flutter packages pub publish" fails #3037

Related

you already have an app with that package name

I need help with flutter and firebase package name
I’m trying to add 3 android apps that are using the same backend server to firebase, I have managed to add 1 app and when I try to add the second one I’m getting this notification “ you already have an app with that package name” that is in firebase.
how do i go about it?
with the solutions I have found, I have to rename the 2nd and 3rd package name, but I don't seem to understand why I should that or the concept behind it.
You need to use a different package name "com...XXX" in every project it's like your app's unique id.
you can change app name by following this steps
Step 1
Go to file android/app/buil.gradle in your flutter project
android{
//make sure every project has different application ID
defaultConfig {
applicationId "com.example.xyz" //change here
}
}
Step 2:
run commands
flutter clean
flutter pub get
flutter run
Step 3
Remove your old project from firebase and reconnect your new name project

How to add flutter packages to pubspec.yaml automatically in vscode

How do I flutter packages to the pubspec.yaml file without going directly to the pubspec.yaml file.
I want to be able to add packages without leaving the current page I am working on.
I have seen this done in several tutorials and I want to know how it is done.
There are two ways of doing auto import in vscode:
Setting up Pubspec assist in VScode
Using the terminal (this does not require any extension)
1. To setup in Pubspec Assist vscode use the instructions below:
Install Pubspec assist extension in Vscode
Then go to the command panel using the shortcut [Ctrl+Shift+P on Windows OR ⌘+Shift+P on Mac](without the '+')
On the text field type - Pubspec Assist: add/update dependencies
Enter the name of the package you want to find
Nb:
You install multiple packages once by separating them with commas
eg: bloc, provider, http
You only need to go through process 2 to 5 whenever you need to install a package again
hope this helps😊
2. To use Terminal
Go to the terminal and type: flutter pub add <package name>
eg: flutter pub add bloc
To upgrade a package use: flutter pub upgrade <package name><br>
eg. flutter pub upgrade bloc
this second method does not bring up a dialog but also does the same auto import
Have a nice day 👋

Getting A private package cannot be published, when trying to publish flutter plugin

When trying to publish a flutter plugin by running flutter pub publish --dry-run I'm getting the following.
A private package cannot be published.
You can enable this by changing the "publish_to" field in your pubspec.
The problem turns out that I was running this command inside the example directory.
Just needed to change to the root directory of the plugin and it works fine.

Why app overriding after installing in android?

I build an app using flutter. For example name is ForSaudi. I wanted to copy the same app and which name should be ForJordon.
So ForSaudi is already installed in my mobile. Everything is good. Now I changed the name to ForJordon from AndroidManifest.xml file. After changing name and launcher icon, I installed the app into mobile, which is actually replaced with my previous app. It should not be replaced. Can someone guide me how can I do that? I would really appreciate.
Only changing name doesn't create new package. You also need to make changes in build.gradle and in your MainActivity.kt.
If you want a simple solution. Directly use this package
and run this command
flutter pub run change_app_package_name:main com.new.package.name

Why `Flutter Doctor` and `New Application Project` fails in my VSCode setup?

Following these directions, like:
Install the Flutter and Dart plugins
Start VS Code.
Invoke View > Command Palette….
Type “install”, and select Extensions: Install Extensions.
Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin.
Validate your setup with the Flutter Doctor
Invoke View > Command Palette….
Type “doctor”, and select the Flutter: Run Flutter Doctor.
Review the output in the OUTPUT pane for any issues. Make sure to select Flutter from the dropdown in the different Output Options.
Step 3 of validate instructions results with OUTPUT:
I did install flutter, and flutter doctor in a new command shell gives result:
What am I missing here? I also try VSCode extension palette command Flutter: New Application Project and that also fails with:
Make sure that you have installed Git and that you can access it from the command line. Check your PATH. Flutter SDK directory should be present there.
If that does not work, you should try to reinstall the dart and flutter extension.
Next Step should be to reinstall flutter.
It occurred to me that my attempt to support multiple flutter versions might be going outside of the conventions supported by the Flutter extension for VSCode.
Here's what's up!... If you think you're smart like me and installed different versions of flutter in folders like c:\src\flutter\1.20.2 and c:\src\flutter\1.22.6, then you can forget it because the extension is smarter than us, and will ignore this regardless of our PATH assignment.
Copying contents of my flutter install from c:\src\flutter\1.22.6 to the parent folder c:\src\flutter resolved my issue. I need to review how to easily support different versions of flutter. Hmmm..
BTW... what I realized in retrospect is that the complaint about git is raised by the extension not finding the .git folder under the flutter folder (i.e. c:\src\flutter) that it presumed as the path to my flutter install. Well duh!! That's because I want flutter to be sourced at the versioned sub-folder (i.e. c:\src\flutter\1.22.6). Oh well.
Some scenarios I am left pondering:
How to correctly support multiple flutter installations while also benefiting from the extension (is there a way to configure this extension or my environment as a whole)?
Are my expectations to support multiple flutter installations unreasonable?
If my expectations are reasonable, and there are no known or documented way to support multiple flutter installations while also using this extension, then perhaps the extension has a bug?