Question #298MediumFlutter Basics

Normal counterScreen code inside that widget add another childer which is ExpensiveWidget now instead of using setState() use any other state management to update the counter value ? because expensive widget is not needed to rebuild when the counter value is updated ?

#widget#state

Answer

Overview

Create a counter screen with an expensive widget (that shouldn't rebuild on counter updates) using Riverpod or Provider instead of

text
setState()
. This isolates the counter state from the expensive widget's rebuild.