Flutter Shared preferences

Flutter Shared preferences :

Flutter Shared Preferences Util

plugin
shared_preferences:

import package in flutter 
import 'package:shared_preferences/shared_preferences.dart';

Flutter tutorial provide how to store data persistence in flutter app.

Example :

SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString("token", event.token);
prefs.getString("token");

1) Set data : set method use.

  • setString
  • setBool
  • setInt
  • setDouble
  • setStringList

2) Get data : get method use.

  • getString
  • getBool
  • getInt
  • getDouble
  • getStringList

3) Remove


for example. When user logout must be remove username, id etc.
prefs.remove(“key_name”);

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in