问题描述
这是错误消息
: The following NoSuchMethodError was thrown building Consumer<PageOffsetNotifier>(dirty,: dependencies: [_InheritedProviderScope<PageOffsetNotifier>]):
: The method 'unary-' was called on null.
: Receiver: null
: Tried calling: unary-()
这是消费者类
class LeopardImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<PageOffsetNotifier>(
builder: (context,notifier,child) => Positioned(
width:300,left: -notifier.offset,child: child,),child: Image.asset('assets/leopard.png'),);
}
}
此处 PageOffsetNotifier 是扩展了 ChangeNotifier 并传递给 ChangeNotifierProvider
的类通知程序会在将一页滑到另一页并执行所需功能时检测到偏移值的变化....
请告诉我消费者中我缺少什么或做错了什么,结果是我收到了此错误
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)