We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I added print(shoppingList.length); this sentence to showData(), such as the following code:
print(shoppingList.length);
The showData() method in build():
Flutter-Projects/ch_06/lib/main.dart
Lines 39 to 41 in 9b16f73
showData() source code:
Lines 97 to 103 in 9b16f73
Add print(shoppingList.length); to showData()
Future showData() async { await helper.openDb(); shoppingList = await helper.getLists(); // print here print(shoppingList.length); setState(() { shoppingList = shoppingList; }); }
I found that showData() is actually being called repeatedly all the time.
It seems that showData is called in build, and setState in showData will cause build to be called again, which leads to a circular call.
This should be incorrect, right? Wouldn't this lead to a waste of resources due to non-stop rebuilding?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I added
print(shoppingList.length);
this sentence to showData(), such as the following code:The showData() method in build():
Flutter-Projects/ch_06/lib/main.dart
Lines 39 to 41 in 9b16f73
showData() source code:
Flutter-Projects/ch_06/lib/main.dart
Lines 97 to 103 in 9b16f73
Add
print(shoppingList.length);
to showData()I found that showData() is actually being called repeatedly all the time.
It seems that showData is called in build, and setState in showData will cause build to be called again, which leads to a circular call.
This should be incorrect, right? Wouldn't this lead to a waste of resources due to non-stop rebuilding?
The text was updated successfully, but these errors were encountered: