ancestorInheritedElementForWidgetOfExactType is deprecated

Posted by Editorial Staff | Updated on

ancestorInheritedElementForWidgetOfExactType is deprecated. Use context.getElementForInheritedWidgetOfExactType<_BlocProviderInherited>().widget and it should work.

As far as benefits go, the documentation basically states the same though someone can correct me but I don’t see any difference. You should be able to get rid of the _typeOf variable.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers