state-management

Flutter: Read the Stream data of a BloC state and re-render the UI if it changes

点点圈 提交于 2020-12-13 03:33:00
问题 I have a problem with using the BloC pattern in combination with showing a download process using Dio. Can anybody tell me, how to get the onUploadProgress from dio into a bloc state and display it when the progress inside the state updates? At the moment I have the UI, the BloC and an API class. I need to pass my bloc into the API call to download a file and then add an extra event like so: onReceiveProgress: (int received, int total) => { bloc.add(DownloadingImages((received / total) * 100)

Persist Provider data across multiple pages not working

与世无争的帅哥 提交于 2020-08-07 07:18:41
问题 I'm using Provider in my flutter app, and when I go to a new page, the data provided to the Provider at page 1 is not accessible in page 2. The way I understood the way Provider works, was that there is a central place where one stores all the data, and one can access that data anywhere in the application. So in my application, which is shown below, ToDoListManager is the place where all the data is stored. And if I set the data in Page 1 , then I will be able to access that data in Page 2 ,

changenotifierProvider vs ChangeNotifierProvider.value

此生再无相见时 提交于 2020-04-14 12:13:29
问题 I am quite new to this framework and working on state management using provider package where I come across changeNotifierProvider and ChangeNotifierProvider.value but I am unable to distinguish their use case. I had used ChangeNotifierProvider in place of ChangeNotifierProvider.value but doesn't work as intended. 回答1: Does the official documentation help? DO use ChangeNotifierProvider.value to provider an existing ChangeNotifier : ChangeNotifierProvider.value( value: variable, child: ... )

Flutter provider state management, logout concept

我的未来我决定 提交于 2020-02-14 17:09:46
问题 I am trying to implement custom logout solution for my application, where no matter where user currently is, once the Logout button is clicked, app will navigate back to Login page . My idea was, that instead of listening on every component for state changes, I would have one single listener on a master component -> MyApp . For the sake of simplicity, I have stripped down items to bare minimum. Here is how my Profile class could look like: class Profile with ChangeNotifier { bool

Flutter provider state management, logout concept

坚强是说给别人听的谎言 提交于 2020-02-14 17:09:17
问题 I am trying to implement custom logout solution for my application, where no matter where user currently is, once the Logout button is clicked, app will navigate back to Login page . My idea was, that instead of listening on every component for state changes, I would have one single listener on a master component -> MyApp . For the sake of simplicity, I have stripped down items to bare minimum. Here is how my Profile class could look like: class Profile with ChangeNotifier { bool

Flutter provider state management, logout concept

北城余情 提交于 2020-02-14 17:09:02
问题 I am trying to implement custom logout solution for my application, where no matter where user currently is, once the Logout button is clicked, app will navigate back to Login page . My idea was, that instead of listening on every component for state changes, I would have one single listener on a master component -> MyApp . For the sake of simplicity, I have stripped down items to bare minimum. Here is how my Profile class could look like: class Profile with ChangeNotifier { bool