Flutter Table Calendar Update Firestore Data - flutter

I am using the Table Calendar package with flutter. Please note that I am using Firestore.
I am trying to figure out how to update the list of items instantly when the user adds or deletes items. So far I need to click on the day again to see changes. I am using setState in the onDaySelected which currently updates the data. Thanks in advance for your help.

That requires a more complex state management than using setState. Check the flutter_bloc package for example. You also have riverpod and one of the most simple is provider. You can find a lot of information in their apis and even online.
The packages:
flutter_bloc
riverpod
proivider
There is also a complete list of all the state management packages you can use in Flutter. Here's the official list, and you also a not official list (however it is also valid!).

Related

Stateful Classes Flutter project

I'm trying to generate a Flutter app, to create a stateful text field that I can call from other class (passing a name of the field and a limit for the field)., but I don't know how to do that,
Basically, I'm trying to be concise and reduce the amount of code for (variables)consecutive text fields.
Could someone help me?
In Flutter, you don't usually work like that.
Instead, use state management classes to store any manage state information, and provide a Stream instance that is then used to update your widgets (TextField) when state changes.

Is there a way to remove all states in state management in flutter?

So currently i am using flutter providers package for managing state in my app.
Things i am able to do currently:
Maintaining a bool variable and using it to maintain states globally.
Having a string in which there is some text and it changes as user types in something and displayed on home page.
when i click on a button is there a way to erase all my maintained states to earlier one, i.e. to remove all states? I am managing lots of states for my app and it is cumbersome to manually change them to earlier one on clicking button.
Check out this question. The top answer is by the author of the Provider package. Alternatively, you could try out the Phoenix package as suggested in another response.

best way to share data between pages in flutter

I have many pages and I want to share file content between some pages, also giving this pages ability to modify content, the file contains (obj, data (int, bool, ...)).
1st: share file content between some pages can be done by using Constructor.
2nd: ability to modify conten can only be done by global variable+ key, but go for stateManagement.
I suggest, you should go for StateManagement. It can handle that.
I perefer using riverpod, also people suggest using getx being easy to use.
for more read this.
You can try the provider package as it's an effective tool for sharing data a cross your flutter app: https://flutter.dev/docs/development/data-and-backend/state-mgmt/simple
Either use constructors to dig through the widgets or simply use one of the packages for state management like provider, getx, bloc and many others.
But if you are a beginner then go with provider package as it is recommended by flutter team

Is there any tool that I can use to manage global data in flutter?

Recently I'm working in a basic project to learn a little bit more of flutter.
But I found a blocker... which is that I have to pass data consistently and updated between a widget and its parent, so I wonder if is there any tool or extension to add that let me manage global scopes in my widgets.
Something like redux o a similar concept... Is there any of it? How can I control data in a flutter project if I need to use them in different widgets?
Thanks for your help

Flutter Firestore, where is the site that upload reference documents?

I have seen official flutter firestore material only in pub.dev
But there even wasn't a single sentence about getDocuments().
Which site should I look at if I want to do a full formal study on this?
I have already seen cookbooks on flutter dev.
Not much to study, there is even implementation on API refrence. However its just few lines, but I don't know what more there could be...
You can get there from package main page, on the right.