DEV Community

loading...

Different ways of local storage in flutter

rrtutors
I am an Android and Flutter Developer. Having 7+ Years of Experience in Mobile application development. Looking for article writers on my website.
・2 min read

Different ways of local storage in flutter

In flutter mobile applications we have different ways to store data in locally

They are

  • Sharedpreference

  • Sqflite Database

  • Hive Database



  • Alt Text


    Sharedpreference

    SharedPreferences is used for storing data key-value pair in the Android and iOS.
    SharedPreferences in flutter uses NSUserDefaultson iOS and SharedPreferences on Android, providing a persistent store for simple data

    How to use SharedPreferences in Flutter?


    Sqflite database

    SQflite is a plugin for flutter. It allows us store, retrieve and manipulate our SQLite databases via flutter code. SQflite supports both Android and iOS platforms

    Here are some of the features of SQFlite:

  • SQFlite provides for both database transactions as well as batches.

  • SQlite has inbuilt automatic version managment.

  • SQFlite provides easy to use methods for inserting, querying, updating as well as deleting data from database.

  • These CRUD operations are performed in the background thread on both iOS and Android. This frees the UI to remain responsive
  • How to Install SQFlite and SQflite CRUD Operations


    Hive Database
    Hive is a quick, lightweight, NoSQL database for flutter and dart applications. Hive is truly helpful if you need a straightforward key-value database without numerous relations and truly simple to utilize. It is an offline database(store data in local devices). It has no native dependencies (it runs on Flutter Web!) can be the ideal choice. Hive bolsters all stages upheld by Flutter

    How to setup Hive database in flutter

    How to Store Image as String in Flutter

    How to Copy database from assets folder

    Discussion (1)

    Collapse
    paulofreire profile image
    Paulo Freire

    I used to use this when I wanna encrypt the data.
    pub.dev/packages/flutter_secure_st...