This package library will make it very easy and fast to change flutter android package name.
How to use flutter change package name
So, Let’s begin with how to alter android package name in your flutter application.
1. Adding dev dependencies
Open <flutter project> / pubspec.yaml under this file look for dev_dependencies : section, just below it add change app package name, as shown in below screenshot.
dev_dependencies:
change_app_package_name: ^0.1.2
2. Updating Flutter pub get
Once you have added any new dependencies in pubspec.yaml file, you always need to update it,
Then, to do that you need to run a commant i.e.
flutter pub get
Then, this commend will download the latest dependencies library files in your flutter project External Libraries, in our case it change_app_package_name.
3. Running a command to alter package name
You just need to run a command that will alter package name of your flutter android module.
See down of your IDE(Android Studio/VsCode) you may see terminal open it and just paste below cmd that will automatically change package name of your project.
flutter pub run change_app_package_name:main com.new.package.name
Welcome to Proto Coders Point, In this article we will learn how to generate signed apk of your flutter code in android studio. There are various ways to create a APK file, But in this article we will check out the simplest & easiest way to do it.
NOTE: THIS ARTICLE WILL BE JUST ON GENERATING SIGNED APK FOR ANDROID PUBLICATION.
How to Build Signed APK?
You have completed your flutter project & is ready to be published to the world through play store.
Then, now you are here to know how to generate signed apk of your flutter project.
Let’s Begin, Here is my Flutter Project built in android Studio(IDE),
Flutter Project Structure – Generate Signed APK.
So let’s see the process of building a signed APK in flutter project.
VIDEO TUTORIAL
Time needed: 5 minutes
How to generate signed apk in flutter android studio
Open Android module in android studio
In Android Studio tab bar, Navigate towords Tools > Flutter > then Open Android module in android Studio.
Check out the screenshot for path reference.
Open Project in new window
This will open android module version of your flutter project
Generate Signed Bundle/APK file
Now, you will have a new window of your android studio, where your flutter project android verison is been opened.
Click on Build > Generate Signed Bundle/APK
After Clicking on it you will see a new pop dialog box, there select apk/bundle.
Creating new key store path
Click on create new… Here set a key store path there you want to create key store for your flutter project.
Configure signing in gradle
Open /android/app/build.gradle file Just before android block: add below keystoreProperties
def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file(‘key.properties’) if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { … }
Please note that after making any changes in build.gradle file, you need to run as comment in your IDE “flutter clear” so the the changes will affect in signing process.
Select Build Varient as release
After creating keystore & seting Alias & password hit next button.
If you are creating apk for final app release on play store then select release else if you are giving for testing you can select as bebug.
Full APK Signature
You can see in above 5th step i have selected V2 (Full APK signature) to create full release version of my android flutter project
Locate to the path
Now we have created signed apk successfully, To locate to the path where release version of apk is created check out below screenshot.
Hi Guys, Welcome to Proto Coders Point, In this android tutorial article we will learn how to add a Search filter to a RecycleView in Toolbar SearchView in Real-time.
Video Tutorial on filter recyclerview android using SearchView
Here, In the above code, the menu is given an id, an Icon (a search icon, you need to create a vector search image in your drawable folder),
And to make it expandable I am using shows actionwith collapseActionView attribute, By doing this we can the menu as an icon in our android app bar when this icon is been pressed/clicked it will expand, and hence the user can input text in Android SearchView.
Add some images
You need to add some images under the drawable folder so that you can show images in your recycler view cards.
Eg: In my case, I have just created few vector images in my drawable, you can see in the below screenshot
Now, let’s procedure in creating a Recyclerview with Filterable search filter – android filter recycler view using search view in toolbar
In this custom layout for recycler view, we have 2 views i.e. ImageView & a TextView, Where we will display our Data Model Data in a form of recyclerview.
Data Model that hold List of Data’s
ItemDataModel.java
package com.example.recycleviewexample.DataModel;
public class ItemDataModel {
int image;
String txtname;
public ItemDataModel(int image, String txtname) {
this.image = image;
this.txtname = txtname;
}
public int getImage() {
return image;
}
public String getTxtname() {
return txtname;
}
}
Recyclerview Adapter
Then, we need a RecyclerView Adapter that will help us in creating views and show a list of data in recycleview.
Here, In the below lines of codes, We Implement a Filterable interface into our RecyclerView Adapter class and then create our own Filter Method, Where we are applying filtering logic using perform filtering method which will filter return result to publishresult method and then apply the searched Filter data and show it to the user on the RecyclerViewscreen.
There I am using 2 array list,
First One holds a complete ArrayList of data’s and
the second holds the only ArrayList of Data that a user search in the SearchView Search Filter.
RecyclerAdapter.java
package com.example.recycleviewexample.Adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.recycleviewexample.DataModel.ItemDataModel;
import com.example.recycleviewexample.R;
import java.util.ArrayList;
public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.MyViewHolder> implements Filterable {
private ArrayList<ItemDataModel> dataSet;
private ArrayList<ItemDataModel> FullList;
class MyViewHolder extends RecyclerView.ViewHolder {
ImageView imageView;
TextView tvName;
MyViewHolder(View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.imageview);
tvName = itemView.findViewById(R.id.tvName);
}
}
public RecycleAdapter(ArrayList<ItemDataModel> itemList) {
this.dataSet = itemList;
FullList = new ArrayList<>(itemList);
}
@NonNull
@Override
public RecycleAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_layout_for_recyclerview,
parent, false);
return new MyViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull RecycleAdapter.MyViewHolder holder, int position) {
ItemDataModel currentItem = dataSet.get(position);
holder.imageView.setImageResource(currentItem.getImage());
holder.tvName.setText(currentItem.getTxtname());
}
@Override
public int getItemCount() {
return dataSet.size();
}
@Override
public Filter getFilter() {
return Searched_Filter;
}
private Filter Searched_Filter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
ArrayList<ItemDataModel> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(FullList);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (ItemDataModel item : FullList) {
if (item.getTxtname().toLowerCase().contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
dataSet.clear();
dataSet.addAll((ArrayList) results.values);
notifyDataSetChanged();
}
};
}
MainActivity.java
Then, In our MainActivity, we are creating a List of Data and passing the data to RecyclerView Adaptor to display them,
To show a Search View Menu in our App Toolbar we are using @OverrideonCreateOptionsMenu where we will use MenuInflater to show Search Menu,
Then connect our SearchView with our Menu Search,
using setOnQueryTextListener we are detecting onQueryTextChange where user enter Search Filter String we will pass to the string to our adapter method (adapter.getFilter().filter(newText))
Then our adapter method will create new dataSet and display the searched data to the user.
call api in flutter example register user data in database
Hi Guys, Welcome to Proto Coders Point, In this tutorial we will create a registration form with validation and send data to – api call in flutter to store data to database the data in json maped format to php script, and the php script will help in storing data in phpmyadmin database.
So Let’s Begin
#Video Tutorial
My Database (Phpmyadmin)
This is my database, Here in my database i have created a table by name “registered”, This table has 5 field i.e. id,name , email, phone, password. where all our registered use data will get stored.
My PHP API SCRIPT
Connecting to my server database
connect.php
<?php
//replace username with your phpmyadmin username
//replace password with your phpmyadmin password
// replacce database name with your database name
$conn = mysqli_connect("localhost", "username", "password", "databasename");
if($conn)
{
//echo "Connection Success";
}
else
{
//echo "Connection Failed";
}
?>
The above connect.php code is used to get connected to your phpmyadmin database
Future RegistrationUser() async{
// url to registration php script
var APIURL = "https://protocoderspoint.com/php/registration.php";
//json maping user entered details
Map mapeddate ={
'name':_name.text,
'email':_email.text,
'phone':_phone.text,
'password':_password.text
};
//send data using http post to our php code
http.Response reponse = await http.post(APIURL,body:mapeddate );
//getting response from php code, here
var data = jsonDecode(reponse.body);
print("DATA: ${data}");
}
Complete Flutter Code to send registration form data to API Script (PHP Script)
Hi Guys, Welcome to Proto Coders Point, So a few days back I got a query from one of my subscribers on my youtube channel that his android studio logcat is not showing anything,
Then Today I was working on my project and I was testing the app on my 2 devices as shown in the video Below
Then what was happening is MI A2 log data is getting displayed in android studio, but Redmi Note 7 Pro logcat not showing android studio. Even I faced the same issue i.e. android studio logcat not showing.
So Then I tried to find the solution for the Empty logcat, I visited StackOverflow and many other websites to find the Solution, I almost spend 4 hours solving it.
Android studio logcat not showing anything
So here are some Solution you can try
Solution 1: Restarting your Android Studio
In your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.
Refer screenshot below
Solution 2: Restart your mobile Devices
Just restart your mobile device and then check if logcat is showing or no.
Solution 3: Android Debug Bridge (ADB) use libusb backend
and then restart your android studio with Invalidate cache & Restart
Solution 4: Increasing Logger Bugger Sizes ( This Worked with me )
In your mobile device go to –>Settings –> Developer Options –> search for Logger buffer Sizes ( change it to 1M or Bigger size ) and then your android studio IDE will show data in Logcat.
Flutter provider login example firebase auth email password
Hi Guys, Welcome to Proto Coders Point, In this flutter tutorial we will create a flutter app for demonstrating “Firebase login example using provider package”.
Video Tutorial for Firebase login using flutter provider
What is Flutter Provider?
In Short, Provider flutter is like a way to use an InheritedWidget.
For Example: If any data gets changed and need to updated into the App UI, then Instead of rebuilding full hierarchy of Widgets, we can simply Update value of Flutter Provider Consumer Widgets.
Watch video tutorial to add firebase to your flutter app
So now our flutter project is been connected to our firebase console.
Step 3: Add Required Dependencies
So as you now we are adding authentication feature using Firebase service i.e. Firebase Authentication so for that we need firebase_auth dependencies, and by using provider flutter we will implement provider login & Registration to firebase so for that we need provider dependencies.
Open pubspec.yaml file and all both the dependencies
dependencies:
firebase_auth: # for latest version visit official site
provider: ^4.3.2+3
Step 4 : Create Folder
Under lib directory of your flutter project create 2 folders namely as stated below:
ProviderHelper : This will have 1 dart file “ProviderState.dart”, that will help us in registration and Login to the flutter application using firebase auth functions.
Screens : Here we will have 3 dart file, First for Registration UI Screen : Used to register to firebase auth. Second for Login UI Screen : Used to login using firebase auth. Third for Dashboard Page : after success login page.
Step 5 : Code
Under ProviderHelper folder create a dart file by name : ProviderState.dart and copy the code as given below.
In above code we make use of firebase auth instance using which we can call firebase auth methods: createUserWithEmailAndPassword : This Method accept 2 parameter i.e. Email & Password string, When this is called it will create auth user in firebase auth console. signInWithEmailAndPassword : This Method also accept 2 parameter i.e. Email & Password string, When this is called it will check in firebase auth if user account is exist, if yes then user will be logged in to the app.
UI Screen
Under Screens folder create dart file as below and add respective code