I have a web site built with flutter for web and currently, am trying to save to web local storage or cookie but can't seem to find any plugin or way to archive that.
See Question&Answers more detail:osI have a web site built with flutter for web and currently, am trying to save to web local storage or cookie but can't seem to find any plugin or way to archive that.
See Question&Answers more detail:osYou can use window.localStorage
from dart:html
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');
}
}