inheritFromWidgetOfExactType is deprecated use dependOnInheritedWidgetOfExactType instead

The API changed slightly.

Now instead of taking a Type as argument, the method is generic.

Before:

final widget = context.inheritFromWidgetOfExactType(MyInheritedWidget) as MyInheritedWidget;

After:

final widget = context.dependOnInheritedWidgetOfExactType<MyInheritedWidget>();

Note that the cast is no longer necessary

Leave a Comment

tech