Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

void return type issues #21

Open
connelevalsam opened this issue Dec 20, 2020 · 4 comments
Open

void return type issues #21

connelevalsam opened this issue Dec 20, 2020 · 4 comments

Comments

@connelevalsam
Copy link

Lesson 11:

  void toggleView(){
    //print(showSignIn.toString());
    setState(() => showSignIn = !showSignIn);
  }

  @override
  Widget build(BuildContext context) {
    if (showSignIn) {
      return SignIn(toggleView:  toggleView);
    } else {
      return Register(toggleView:  toggleView);
    }
  }```

throws error: this expression has a type of void so it's value can't be used parameter type function
@Suren55
Copy link

Suren55 commented Jan 4, 2021

what does the "toggleView" property of SignIn widget accept? My doubt is that because the toggleView() method does not return anything, you can't assign "nothing" to a property of a widget

@connelevalsam
Copy link
Author

but that's exactly what he did

@vagabond0091
Copy link

did you guys solve this problem? im stuck on this question

@VishruthVS
Copy link

yes check it out:
https://github.com/VishruthVS/FlutterAuthentication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants