ancestorInheritedElementForWidgetOfExactType is deprecated. Use context.getElementForInheritedWidgetOfExactType<_BlocProviderInherited
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[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.