Passing Data to a Stateful Widget in Flutter

Don’t pass parameters to State using it’s constructor. You should only access the parameters using this.widget.myField. Not only editing the constructor requires a lot of manual work ; it doesn’t bring anything. There’s no reason to duplicate all the fields of Widget. EDIT : Here’s an example: class ServerIpText extends StatefulWidget { final String serverIP; … Read more

How to pass data from 2nd activity to 1st activity when pressed back? – android

Start Activity2 with startActivityForResult and use setResult method for sending data back from Activity2 to Activity1. In Activity1 you will need to override onActivityResult for updating TextView with EditText data from Activity2. For example: In Activity1, start Activity2 as: Intent i = new Intent(this, Activity2.class); startActivityForResult(i, 1); In Activity2, use setResult for sending data back: … Read more