Skip to content

Instantly share code, notes, and snippets.

@Yhomarth
Last active June 4, 2020 15:24
Show Gist options
  • Select an option

  • Save Yhomarth/76a612ce9c31345ba06a0565523ba897 to your computer and use it in GitHub Desktop.

Select an option

Save Yhomarth/76a612ce9c31345ba06a0565523ba897 to your computer and use it in GitHub Desktop.
Sample of shared preference on flutter
import 'package:shared_preferences/shared_preferences.dart';
class PreferenciasUsuario {
static final PreferenciasUsuario _instancia = new PreferenciasUsuario._();
factory PreferenciasUsuario() {
return _instancia;
}
SharedPreferences _prefs;
initPrefs() async {
this._prefs = await SharedPreferences.getInstance();
}
PreferenciasUsuario._();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment