how to save state in flutter am trying to make a quantity number which is displayed in text widge there is plus and minus button once I go back from the page the quantity becomes zero even though i have made it any other number
3 Answers
Since your use case is simple , it only requires storing the requisite data to JSON or UTF-8 and writing this data to an editable File.
1.Saving data as JSON
The dart:convert library has converters for JSON and UTF-8, as well as support for creating additional converters. JSON is a simple text format for representing structured objects and collections. UTF-8 is a common variable-width encoding that can represent every character in the Unicode character set.
2.Creating and saving to an editable File
The I/O library enables command-line apps to read and write files and browse directories.
Comments
When asking questions on StackOverflow, it's generally preferred to share some code that you have tried.
In your case, it's likely that you need to use setState in your widget somewhere to modify the value of a variable in your widget class. But without seeing your code, it will be difficult to answer completely.
Comments
You can used the provider package in Flutter to manage your application state. Here is the link to the provider package and it's documentation.