Created
March 2, 2021 09:47
-
-
Save siumhossain/17e35693350f964fbc2cc7c34ddd05c2 to your computer and use it in GitHub Desktop.
pass information from one screen to another screen-flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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