Home > Back-end >  The argument type 'Future<String>' can't be assigned to the parameter type 
The argument type 'Future<String>' can't be assigned to the parameter type 

Time:08-04

how can i solve this? I need to get the email value. enter image description here

CodePudding user response:

You can't do that! You can't affect a future to a property.

You need to first get the value and then affect it to property, like this:

void _newRegisterMethod() async {
    String myValue = await _loginEmail();
    Navigator.pushReplacement(
        context, MaterialPageRoute(builder: (context) => FormWidget(loginEmail: myValue)));
}

Assuming that _loginEmail is a method, not a var, because in your code you have _loginEmail.then, guess it miss parenthesis.

  • Related