0

我正在关注一个颤振教程,它是一个旧教程,所以我已经不得不根据 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;
  }
}
4

1 回答 1

0

updateSouldNotify您的代码中应该有一个错字updateShouldNotify。这应该可以解决问题。

颤振文档有一个Example

@override bool updateShouldNotify(FrogColor old) => color != old.color;

于 2020-06-13T10:26:19.783 回答