How to store user-specific documents in firebase? [closed] - firebase

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm using Flutter and Firebase Firestore to build a note-taking app. I'm trying to store each new note under the signed-in user in Firestore but the notes are visible to all users.

If you have the time, I suggest you watch this fully. It explains clearly and precisely how to make a Note making app with a clean architecture.
Reso Coder's DDD
But, if you just want to get to the firebase security rules and the implementation, then see this:
Create, Update, Delete Notes
and
Firebase Security Rules.
You might wanna see this to get the updated code after firebase's update in flutter.

You can make Collections using the unique user-ID given by Firebase at the time of Registering User!
you can get the user-ID of the current user by executing FirebaseAuth.instance.currentUser.uid
and store the notes as Documents in specific user's Collection.
At the time of Retrieval you can use the Stream Builder and give the Stream as collection of Current User's user-ID.

Related

Implementing ADD friends feture in flutter app like in instagram, snapchat, faceboook [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
i am currently working on a flutter app which is kinda social media app, right now i am stuck with the idea to implement the add friends feature from a list of contacts who have account in my app, but i can not think of any method of doing so , my app's back-end is handled by Firebase with each user's profile information stored differently in Firestore database,
i want a simple and efficient way to add friends in my app, more like Facebook, Instagram, Snapchat,
can anyone suggest me how to implement this feature in my app?
if so please provide links to pages and documentations!
Thank you
There are lots of ways this could be achieved, one is creating a collection Users and each document per user, inside that user document you will have two Lists of user ids 1. friends 2. requests ... so when someone sends a request, add the sender's user-id into requests section inside the receiver's user document, when the user accepts the request delete the user id from the requests and add sender's user-id into friends list.
Root => Users(collection) => userid1(document) => friends(List<String>)
=> requests(List<String>)
This is just one way do your research and use what's appropriate for you. :)

How to authorize certain pages to different users in flutter [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
We got assigned to make event-management (Creating College Events with Firebase) application in flutter. Work we did: Creating Event (form) and returning an event card (containing event details in brief) in Homescreen. But we were told to make different pages for certain users like admin and student coordinators who can only create an event. While users can view event only. With the help of what can we do this?
Is there any library in flutter which we are unaware of?
Do we have to make another layout for admins and another for coordinator and other for users and then connect them?
You can give different levels of authorization to different people.
Maintain a users collection in your Firebase database
For each user, create a document. You might already be storing details like name, uid, email, etc. In addition to that, maintain a string field level.
Upon login, check user's level. For instance, if the level==student you can display on your homepage only the button that will lead to event_list_page.dart.
If level==admin, also display a button tocreate_event_page.dart.
How will you assign the level?
If there are only a handful (5-6) admins, manually edit their tag in Firebase console.
(Assuming email auth) Otherwise, you will have to create a list of email ids of admins, in advance. Then you can simply run a script using Firebase Admin SDK to fetch the user documents of admins from your users collection in database.
If you don't want to use Firebase Admin SDK, you can also write some code in Flutter itself to fetch admin documents and update their tag.

Timed Support Chat In Flutter [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am working on a flutter project with payment integration. I am very good at front end side but when it comes to back-end it hurts. Anyways I want to add this functionality in my app.
The user will pay price for the consultant. Once the transaction is done I want to give the user a option to chat with the support team of the app but for only 2 days not more than 2 days after the payment. I am using purely using firebase for CRUD functions but I am stuck on this. I have done this in php with sessions but I can't figure out how can I do it using firebase.
Any detailed help/guidance will be very helpful.
Thanks.
save user profile inside firestore in a users collection
add a boolean field called subscribed which is an indicator for the user payment, and subscriptionDate
when the user subscribes, record the dattime
every time the user opens your app, first check if he's subscribed or not, then compare the current date with the subscriptionDate
if the user passed the previous step, open the chat page
you can find many tutorials on google that talks about building chat app using firebase in details

How to create stripe standard account with flutter and firebase [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have this amazing flutter app and I managed to set up a payment system with Stripe. My app is a marketplace so I have many vendors and I am able to collect money from the users and transfer the money to vendors. I have create a test vendor and it all works fine in testing mode. Now I would like to let prospective vendors to create a Stripe standard account and connect with my platform. Here are the instruction I would need to follow: link to stripe
I read the instructions but I am not able to understand or implement it. I would like to know if I can implement the steps within my Flutter app or not. I am not familiar with servers but I have managed to use firebase to create charges. My first problem is the redirect URI (what is this?). The second problem is how to handle the response from stripe (step 3) and lastly get the vendor data with a POST request... Is there anything simple to use in flutter? I have seen this and this but I am not sure they can be used...
Can you please clarify what should I do here. Many many thanks in advance
Here is what I did
in firebase: I created an http function, ie exports.createStripeAccount = functions.https.onRequest((req, res)
in stripe: set that function as redirect uri
in flutter: launch(url_to_connect_the_account)
in firebase inside the httpfunction:
return stripe.oauth.token({
grant_type: 'authorization_code',
code: req.query.code,
})
and that's all folks!

How can I implement an invitation system using Flutter and Firebase realtime database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am developing a Flutter app that is using the firebase realtime database. The app shall be used collaboratively by users to collect and analyze data. Users are part of a team and the data that is collected will be associated with the team. For a user to join a team, they are required to use an invitation link that is sent out by the team leader. The invite shall use the teamId which is a unique identifier for each team.
How could I go about this.
It sounds like you have a two-step process:
Create a link for a specific team that the user can click to then get into the app as part of the team.
Sending that link to the user.
For that type of link you can use Firebase Dynamic Links, for which a Flutter wrapper exists: firebase_dynamic_links plugin.
For sending the link you have many options, but the most common ones are to send it through email or SMS/text message. When the user then clicks the link, it can open your app, and you can extract information about the team from the link.
If the target user is already using your app, you can of course skip all this and create a notification system through the Realtime Database. There's nothing pre-made for that, but it's just more use of the APIs you're already using.

Resources