How to send data from one screen to other in flutter app with route navigator
in this artical we will learn how we can send data like key value from one screen to other screen. for that there are some steps and code let see.
step 1: on screen one from where you want to send data , create class with any suitable name , and in this class declare variables which you want to send like this.
now after this i create button on this button press function will call name _sendData with 2 params id and name
in this pic i create a function and on call it i create a final variable which assign the values of id and name to class Data and after assign data will send with navigator.push method to that other screen where you want to send it .
so now after all done on screen one we now move to screen two , on which i create a variable and a class constructor showing in first green box
now on last where we want to print\display the variable value we use in string like ‘${variable name}’ and most important by using this login we can find or variables in “widget” just like in pic.
hope this help you guys . if you want to watch the video also on it link is here