If you want to save to web local storage in flutter web You can use window.localStorage from dart:html to save to web local storage in flutter web.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import 'dart:html'; class IdRepository { final Storage _localStorage = window.localStorage; Future save(String id) async { _localStorage['selected_id'] = id; } Future<String> getId() async => _localStorage['selected_id']; Future invalidate() async { _localStorage.remove('selected_id'); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.