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

Problem with key parameter in the stack_please_wait example. #3

Open
theophany77 opened this issue Aug 31, 2024 · 1 comment
Open

Comments

@theophany77
Copy link

Hi Marc !

I am Jean-michel from France. I bought your book "65 examples" recently and I am reading it carefully.
It is very interesting and, I believe, straight to the point.
I have a problem with the stack_please_wait code.
I use Android Studio on Windows 10.
When I paste the dart code in the main.dart, I have the following error 👍

class HomeWidget extends StatefulWidget {
  HomeWidget({Key key, this.title}) : super(key: key);

The parameter 'key' can't have a value of null because of its type but the implcit default value is null.

Same thing for the title parameter.

I don't know what to do.
What is the type of the 'key' parameter ?
When I try to initialize it, the type I use (int, String ...) is wrong.

Thanks for your help !

Jean-michel

@theophany77
Copy link
Author

After a few updates, it works !
That is what I did :

  1. I added a "?" after each "Key" :

HomeWidget({Key? key, ........

  1. I initialized the "title" parameter :
class HomeWidget extends StatefulWidget {
    var title;

Is it what you would have done, Marc ?

Regards.

Jean-michel.

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

1 participant