Hive for Flutter [Tutorial]#1:When, Why. #database

Vivek Yadav
2 min readNov 5, 2019

--

** Flutter Database **

Q: What is Hive?

Ans: Hive is Lightweight and Blazing fast key-value database written in pure Dart.

Q: How is it different from SQFLite ?

Ans: Sqflite is SQL based local database whereas Hive is a key-value (NoSql) database.

Q. Why should I learn Hive?

Ans: There are lots of reasons to use the hive.

Cross-platform ⚡

  • Runs on desktop, mobile & in browser
  • Very good performance (see benchmark)

Easy to use ❤️

  • Keys are of type String or uint32 and values are arbitrary objects
  • The basic operations are put(key, value), get(key), delete(key)
  • Strong encryption built-in

Lightweight 🎈

  • Small runtime
  • Small disk space consumption
  • NO native dependencies

Find benchmarks here: https://github.com/hivedb/hive

Q. When to use and When not to use?

Ans: 1. When we need to do complex queries then don’t use Hive then go for SqfLite.

2. When we want to store data also we want encryption over our data then use Hive.

3. When we want a single database on all platforms like app, web, and desktop the use Hive.

4. When performance is a very important metric to measure then use Hive.

5. When we are not comfortable with SQL then use Hive.

Note: Search is not provided by Hive now.

We have to implement Search by our own.

For more visit this

We will see the implementation of the Hive in #2 part.

Let me know if you find difficult to understand this. I would love to solve your problems.

Github Link : https://github.com/viveky259259/flutter_for_people/

#HappyCoding #flutter #widgets #hive #database

**Subscribe for upcoming posts. Thanks for reading. Let me know what you think about this post.

--

--

Vivek Yadav
Vivek Yadav

Written by Vivek Yadav

Writer , Speaker, Instructor and Flutter Dev

No responses yet