我对在Flutter中使用Provider是个新手。 我有一个名为CambiarFotoPerfil的类,其中我需要一些函数来将文件上传到远程web服务器。usuarioProvider = Provider.of(context);
usuarioProvider.setimagen(fileName); 我在编辑器中没有收到任何警告,但一旦执行了应用程序,就会抛出一个错误: Tried to listen to a value exposed with provider, from outside of the widget tree 在</
在我的Flutter应用程序中,我必须在推送通知到达时立即更新提供者持有的状态,以便可以重建UI。PushNotifications服务是一个类(而不是小部件),如下所示: ...here I receive the data from the notification that I have to add to the provider
}这是我的简单提供者