我正在遵循一个flutter教程,这是一个老的,所以我已经不得不做出改变,因为在dart和一些库的变化,但我得到这个错误,在教程的家伙得到没有这样的错误。PS:它是唯一一个 "StoriesProvider被定义的地方"
class StoriesProvider extends InheritedWidget { //Missing concrete implementation of InheritedWidget.updateShouldNotify here
final StoriesBloc bloc;
StoriesProvider({Key key, Widget child})
: bloc = StoriesBloc(),
super(key: key, child: child);
bool updateSouldNotify(_) => true;
static StoriesBloc of(BuildContext context) {
return (context.dependOnInheritedWidgetOfExactType<StoriesProvider>(
))
.bloc;
}
}
你的代码中有一个错别字 updateSouldNotify
应是 updateShouldNotify
. 这应该可以解决这个问题。
flutter文档中有一个 例子 .
@override
bool updateShouldNotify(FrogColor old) => color != old.color;