I have created class which extend StatefulWidget
class RegistrationPage extends StatefulWidget {
final String email;
const RegistrationPage({Key key, required this.email}) : super(key: key);
@override
_RegistrationPage createState() => _RegistrationPage();
}
The problem is android studio force me to put required
before Key key
. I googled some of examples how to pass values from screen to another screen and I have never seen that someone used required with Key.
I do it within:
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => RegistrationPage(email: email),
),
);
so just to pass email value. I need to make Key nullable to make it work. Am I doing something wrong?