Difference Between Inherited Widget and BLoC?

Viewed 675

I'm Searching a lot about the Difference between Inherited Widget and Bloc State management

I found that Inherited Widget is immutable but Bloc don't
I know the mutable and Immutable concept well but I just want to ask

Why inherited widget is Immutable and what difference between it and Bloc ?

1 Answers

Bloc and inheritedWidget are very different things.

Bloc is component that takes events as an input, react to this event and yields state through stream. Widgets then can listen to this stream of events and rebuild when new pierce of data is available. Bloc Is independent of widgets that listen to it, or insert events.

Inherited Widget just provides piece of data down to all his children. You have access to this data through buildContext. Also you can notify inherited Widget that Its data changed, which will result in rebuilding all widgets under it.

Related