当前位置:网站首页>(flutter2) as import old project error: inheritfromwidgetofexacttype

(flutter2) as import old project error: inheritfromwidgetofexacttype

2022-07-06 22:56:00 Xiaobai is more than that

An error is as follows :

Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.

 Insert picture description here
resolvent :
1、 Click the blue part with the mouse , Automatically jump to the wrong place . Insert picture description here
2、( reason ) Use flutter2 after ,inheritFromWidgetOfExactType Methods are no longer used , In its place dependOnInheritedWidgetOfExactType.

// final widget = context.inheritFromWidgetOfExactType(_InheritedProviders);
final widget = context.dependOnInheritedWidgetOfExactType(aspect: _InheritedProviders);

This reference article is as follows :
Use flutter2 after ,inheritFromWidgetOfExactType Wrong handling

The following reference has some problems , But it still helps , ha-ha
Flutter Upgrade update 2.0 Post common error reporting processing

原网站

版权声明
本文为[Xiaobai is more than that]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131042125665.html