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

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현