Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save siumhossain/17e35693350f964fbc2cc7c34ddd05c2 to your computer and use it in GitHub Desktop.
Save siumhossain/17e35693350f964fbc2cc7c34ddd05c2 to your computer and use it in GitHub Desktop.
pass information from one screen to another screen-flutter
# 1st screen
Navigator.push(context, MaterialPageRoute(builder: (context){
return LocationScreen(locationWeather: weatherData,);
#2nd screen
build constructor
------------------------
LocationScreen({@required this.locationWeather});
final locationWeather;
==========================
void initState() {
super.initState();
updateUI(widget.locationWeather);
}
============================
void updateUI(dynamic weatherData){
temperature = weatherData['main']['temp'];
condition = weatherData['weather'][0]['id'];
cityName = weatherData['name'];
print(temperature);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment