[SOLVED] Selector vs context.select()

Issue

This Content is from Stack Overflow. Question asked by user17721841

I wonder if there is any difference between Selector Widget and context.select() function. At the end they are do the same, there is any difference between them or it just syntax issue



Solution

context.select is a context method with others like context.read, context.watch. Funtionally they does the same thing, but depending onyour use-case, you can avoid using an extra widget, but while using context methods you need to be careful with widget rebuilds as entire widget inside the build method will be rebuilt, while in case of directly using Consumer or Selector only their children widgets are rebuilt


This Question was asked in StackOverflow by user17721841 and Answered by Sanketh B. K It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?