Flutter - retain Values after Refresh - flutter

I want to learn the best solution for the below mentioned issue.
I'm Using the GETx library for my flutter project.
I have a home page which shows summarized information of some reports. I can choose to create a report. After saving it (inserts into db), i'll be provided with an ID to display on screen. After refresh, the ID and variables reset. (Controller re-init)
Is it best to use SharedPreference in order to save the ID value? And when user refreshes the page, i can query the DB for the ID and display it on page.

Related

How can I have a separate setup process and home page in Flutter?

I am currently building an app that has a first page with two buttons: 'New users -->" and "Existing users -->". The goal is for new users to click their button and go through a setup process that ends with their home page that is saved when the app is closed. The next time a user opens the app, once they click their existing users button, I want the app to open to the home page the setup process ends at. How do I achieving this? Any help would be appreciated!
You can use GoRouter (from flutter team) plugin for handling this scenario and navigation.
https://pub.dev/packages/go_router
While initialising the router, you can provide redirect where you can handle if user should be navigated to the setup screen or home screen.
Use database / shared preference / secure storage to store whether the setup process was completed and what data was saved.
Now if you are using any framework like GetX or something you can easily navigate to the desired pages or you can use Navigator.to.... if not using a framework.
you can use something like
bool isSetupDone = // get from storage
the use this Boolean value to either alert, show/hide button/ popup message accordingly as per your usecase.

Is there any way to fetch the google sheet (gsheet) data in flutter and display realtime updates whenever there is any change in google sheet itself?

I am developing an application where a list is displayed according to the user input. The list is loading and getting displayed when the application is loaded and whenever the user inputs the data through the text fields(in the app) and the cells (in the google sheet) gets appended too ( which is what I want). But I would like to be able to get realtime list append in the application whenever any new data is inserted in the google sheet itself. So how do I listen for changes in google sheet everytime there is any change and update/append the list (in the application) according to it? Currently, whenever the data is inserted in the google sheet itself, the data only gets loaded when I hot restart the application.
Have you tried Apps Script Triggers? Maybe the function onEdit(e) can help:
https://developers.google.com/apps-script/guides/triggers

How to an async function in a child page widget before it gets built when it is navigated to?

I'm new to flutter and working on an application with a dashboard and several pages.
When the app is first opens the dashboard opens up with a bottom navigator to the other pages. On each of the other pages an async http request method is called to retrieve information and populate the page.
However, I want to show a summary of the information collected from these pages on the dashboard when the app first opens up. Is there a way to do this without navigating to any of the other pages or calling all the request methods from the dashboard page?
I've tried callbacks, but these need an active trigger on the child pages and I'm looking to load in all the info before the user even navigates to them.
The only way to have acces to all that data is to either fetch the data in your dashboard file or fetch the date inside the void main function.
You can however put the functions in separate files and import them.
If it's a small application you can pass the data on as prop to the child components.
If it's a bigger application with more data, you can then use Bloc or flutter_redux to globally store the data so you can acces it in other files aswel.
Bloc:
https://pub.dev/packages/flutter_bloc
Redux:
https://pub.dev/packages/flutter_redux

In GA4 is it possible to create custom user/session acquisition properties?

I like the new user acquisition properties, for they do what I think. Tell me how the user first came to the website.
Is it possible to add custom user acquisition properties to add to the data collected. e.g. the first page they ever visited ('user page location'). This could help value pages.
There are the user custom properties but as far as I can see they don't show up in the relevant reports, and I'm not sure how to only set them on the users first page view.
A similar 'session page location' would also be of use, like the landing page report in Universal.

PowerApps- how to create a form where users can edit or delete rows that have been submitted

What I have:
As of now, I have created a Form (editable) where the user can enter their Name, Number, and Birthday, then hit the submit button, and that data is then entered into a Data Table. This information is also stored into Google Sheets for which I have created a flow. (when the user hits "submit", trigger the data to be updated into the google sheet).
What I need:
I would like users to be able to mess with the submitted data in the app itself (add a row, delete a row when you click on it, edit the row's info, etc), so essentially my powerapp is a nice front end for the Google Sheet. Is it possible to mess with the data once it is entered into the data table?
Any help how to do this would be appreciated.
I believe you started building Canvas app from scratch, so the screen has list below and "Add screen" on top. This way you have to introduce the Edit screen/operation & save changes using PATCH command.
There is another way: Create an app automatically from your data in PowerApps. This will give you the Browse Screen, Detail Screen & Edit Screen (aka New record screen) by default with all the Create, Read, Update, Delete (CRUD) operations right away using the Connection - Google sheet in your case.
Video tutorial for assistance