問題描述
在 Onboard Pages 上進行 Flutter 應用程序初始化? (Flutter app initialization at Onboard Pages?)
我想在用戶安裝並啟動應用程序後接受用戶輸入。我想在他第一次使用應用程序時設置語言選擇、日期等參數。
參考解法
方法 1:
Use SharedPreferences
Have a page to take user inputs about your desired parameteres and ssave them in whereever you want to. While saving that, also store a boolean
in SharedPref
to indicate whether app is initialized or not.
In main()
first you read this value from SharedPref
. If the value is present then directly show your app's homepage else show the user input page.
This is similar to apps which have a login screen. In apps the login screen will appear only for the first time till user presses logout.
Check this package: SharedPreference
(by Sardar Badar Saghir、Sisir)