No rerender after setStateFlutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewOpening a new view inside of ListTile - FlutterFlutter list view rendering issueFlutter and Firestore, handle data from StreamBuilderFlutter / FireStore is there a 'right' class or approach to reordering ListTiles created from a Firestore databaseHow to refresh flutter UI on AlertDialog close?ExpansionTile - how to collapse other tiles, hide keyboard on pressFlutter: onTap not producing the ListView.Builder when trailing icon tapped in ListTileHow to pass specific ListTile variables to new page route onTap?

What are one's options when facing religious discrimination at the airport?

PhD Length: are shorter PhD degrees (from different countries) valued differently in other counter countries where PhD Is a longer process?

Can Familiars read and use spell scrolls?

Sending mail to the Professor for PhD, after seeing his tweet

Would an object shot from earth fall into the sun?

Is the "spacetime" the same thing as the mathematical 4th dimension?

Why such a singular place for bird watching?

How to identify whether a publisher is genuine or not?

What is the meaning of first flight and introduction in aircraft production?

Are there types of animals that can't make the trip to space? (physiologically)

GPLv3 forces us to make code available, but to who?

Airport Security - advanced check, 4th amendment breach

What does "execute a hard copy" mean?

How to transcribe an arpeggiated 4-note chord to be playable on a violin?

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

Does the 'java' command compile Java programs?

Bothered by watching coworkers slacking off

Parent asking for money after moving out

Why the first octet of a MAC address always end with a binary 0?

Realistically, how much do you need to start investing?

Could the Queen overturn the UK Supreme Court ruling regarding prorogation of Parliament?

How do we know neutrons have no charge?

How to say "respectively" in German when listing (enumerating) things

Can anyone give me the reason why music is taught this way?



No rerender after setState


Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewOpening a new view inside of ListTile - FlutterFlutter list view rendering issueFlutter and Firestore, handle data from StreamBuilderFlutter / FireStore is there a 'right' class or approach to reordering ListTiles created from a Firestore databaseHow to refresh flutter UI on AlertDialog close?ExpansionTile - how to collapse other tiles, hide keyboard on pressFlutter: onTap not producing the ListView.Builder when trailing icon tapped in ListTileHow to pass specific ListTile variables to new page route onTap?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0















I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.



The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart



I simply edited this part in the _pushSaved() methode:



final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);


I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.



setState(() 
_saved.remove(pair);
this.build(context);
);


Appreciate your help!










share|improve this question



















  • 1





    it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

    – diegoveloper
    Mar 28 at 21:04

















0















I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.



The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart



I simply edited this part in the _pushSaved() methode:



final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);


I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.



setState(() 
_saved.remove(pair);
this.build(context);
);


Appreciate your help!










share|improve this question



















  • 1





    it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

    – diegoveloper
    Mar 28 at 21:04













0












0








0








I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.



The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart



I simply edited this part in the _pushSaved() methode:



final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);


I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.



setState(() 
_saved.remove(pair);
this.build(context);
);


Appreciate your help!










share|improve this question














I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.



The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart



I simply edited this part in the _pushSaved() methode:



final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);


I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.



setState(() 
_saved.remove(pair);
this.build(context);
);


Appreciate your help!







dart flutter






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 20:47









mxcxxmxcxx

183 bronze badges




183 bronze badges










  • 1





    it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

    – diegoveloper
    Mar 28 at 21:04












  • 1





    it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

    – diegoveloper
    Mar 28 at 21:04







1




1





it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

– diegoveloper
Mar 28 at 21:04





it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget

– diegoveloper
Mar 28 at 21:04












0






active

oldest

votes













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406611%2fno-rerender-after-setstate%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406611%2fno-rerender-after-setstate%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript