iamshaunjp / flutter-firebase

All course files for the Flutter & Firebase tutorial playlist on The Net Ninja YouTube channel
578 stars 440 forks source link

void return type issues #21

Open connelevalsam opened 3 years ago

connelevalsam commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

but that's exactly what he did

vagabond0091 commented 3 years ago

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

VishruthVS commented 1 year ago

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