No video

Hive (Flutter Tutorial) - Lightweight & Fast NoSQL Database in Pure Dart

  Рет қаралды 99,720

Reso Coder

Reso Coder

Күн бұрын

Пікірлер: 171
@FilledStacks
@FilledStacks 4 жыл бұрын
Awesome. Hive looks like a much more viable option than SQLite to me in terms of simplicity and ease of setup and use. Thanks for the tutorial.
@rossthemusicandguitarteacher
@rossthemusicandguitarteacher 4 жыл бұрын
The two best coding channels for me at the moment. Much love and thanks for all the help.
@FilledStacks
@FilledStacks 4 жыл бұрын
@@rossthemusicandguitarteacher Thanks Ross! I love myself some ResoCoder too :)
@simonleier502
@simonleier502 4 жыл бұрын
Great video and very well written tutorial. Good job! I added your video to the documentation.
@ResoCoder
@ResoCoder 4 жыл бұрын
Thanks for the library again, Simon!
@rebarius
@rebarius 4 жыл бұрын
@Simon Leier oh yes wanna thank you also sooo much for thie great package 👏🏼 Greatest feature for me is the possibility to save whole dart objects :)
@HarshSingh-hk8fe
@HarshSingh-hk8fe 3 жыл бұрын
hi sir, can i store my shopping app cart list in hive thank you :D
@BrendansReasons
@BrendansReasons 2 жыл бұрын
You're really important to the community, Reso! Thanks!
@Hypothermia1337
@Hypothermia1337 3 жыл бұрын
Most underrated flutter-tutor on youtube! Love your work, it's keeping us folks on coding with flutter! Props to you mate!
@ShitIndie
@ShitIndie 4 жыл бұрын
I was going full inception, listening to The Hives while working with the Hive.
@rydmike
@rydmike 4 жыл бұрын
Thanks, very well made tutorial and useful. I was considering to switch to Hive earlier already for storing app settings. After this I am convinced and with a good and easy to follow guide.
@ResoCoder
@ResoCoder 4 жыл бұрын
I'm glad you found this useful, Mike!
@wSRV
@wSRV 4 жыл бұрын
Great tutorial. And the same for the others on your channel. Keep up the great work, yours is definitely a really good channel to learn Flutter and various libraries!
@ResoCoder
@ResoCoder 4 жыл бұрын
Thank you!
@danieldey
@danieldey 3 жыл бұрын
Very helpful video, much better then documentations for doing it first time.
@Klausi-uq4xq
@Klausi-uq4xq 3 жыл бұрын
I started today with hive...at the beginning hard to unterstand things like typeadapter and so..i fumbeld round about 2 hours with generating of the .g.dart File..because Null Safety Problems from Others dependencies..but now hive is very fast and very nice to handle, Not Like sqlite3 or so. Thank you for this tutorial which i found just a hour later after i solved much of the shown ways alone or by Stack Overflow 🤣
@chetan6406
@chetan6406 4 жыл бұрын
Best channels for learning flutter....thankyou
@mostafafahimi4588
@mostafafahimi4588 3 жыл бұрын
Every second of this video was useful for me. Thanks.
@fununterhaltung6556
@fununterhaltung6556 3 жыл бұрын
Thank you very much for this wonderful tutorial!!
@gmc254quads6
@gmc254quads6 4 жыл бұрын
I solved that analyzer stuff by just using pubspec assist and providing analyzer package that was 2 versions down. That way, when the issue is fixed all i need to do is make the package version empty then run pub upgrade
@nathanzabaldo1054
@nathanzabaldo1054 3 жыл бұрын
Great walk through of Hive, but outdated. Lots of updates in current version 2.0.4 not covered in your tutorial. Would be great to see an updated version. E.g. typeId is required to generate type adapter now and when registering an adapter, typeId cannot be passed as shown in video. I'm sure it's a pain to stay current with updates on packages. Problem is you make tutorials that are too good so we expect you'll keep them current with every minor version update of any package. :)
@ManOnTheMoon2131
@ManOnTheMoon2131 4 жыл бұрын
This was incredibly helpful. Thank you! Subscribed!
@gmc254quads6
@gmc254quads6 4 жыл бұрын
Nice tutorial and thanks for clarifying some stuff for me. On the build _runner/Dart analyzer thing. I shared the same experience but while creating a generator/build library. I almost went mad.
@ResoCoder
@ResoCoder 4 жыл бұрын
I feel you 😰
@AshishGupta16
@AshishGupta16 4 жыл бұрын
best hive video out there!! thanks :)
@dan3f
@dan3f 3 жыл бұрын
Basic question: What would be the difference if instead of using: > final contact = contactsBox.get(index) as Contact; I used this: > Contact contact = contactsBox.get(index);
@mustafashaikh7829
@mustafashaikh7829 4 жыл бұрын
Love your content Sir.....
@SkShofiul
@SkShofiul 4 жыл бұрын
finally new lightweight database !
@saicharansigiri2964
@saicharansigiri2964 3 жыл бұрын
when you said "AUTOINCREMENT" at 18:00 when deleted a contact will it " AUTO DECREAMENT" i mean the KEY
@sagarv6246
@sagarv6246 3 жыл бұрын
don't think so. That's now how Auto Increment works
@MindzGroupTech
@MindzGroupTech 4 жыл бұрын
Ok you got my subscription ... You are being so awesome
@asp1re530
@asp1re530 3 жыл бұрын
WatchBoxBuilder got depricated! Now its used ValueListenableBuilder.
@theflutterboi
@theflutterboi 3 жыл бұрын
Thank you so much for the tutorial 💙.
@officialismailshah
@officialismailshah 2 жыл бұрын
Your content saved my day.... ❤️❤️❤️❤️ Great content...... Keep posting bro you are amazing.....
@PaulMcKillop
@PaulMcKillop 3 жыл бұрын
The build runner failed until I modified the @HiveType annotation to read @HiveType(typeId:0). I am using build_runner version ^1.11.1. I am really enjoying this process. Thanks.
@radurot7673
@radurot7673 2 жыл бұрын
Great tutorial. Is there a flutter hive client/data visualiser to inspect boxes?
@leotrantruc
@leotrantruc 4 жыл бұрын
Great video! Thank you so much.
@shubhamtariyal439
@shubhamtariyal439 3 жыл бұрын
For those who get this error for build_runner: [INFO] Generating build script... [INFO] Generating build script completed, took 613ms [INFO] Creating build script snapshot...... [INFO] Creating build script snapshot... completed, took 25.4s [INFO] Initializing inputs [INFO] Building new asset graph... [INFO] Building new asset graph completed, took 1.3s [INFO] Checking for unexpected pre-existing outputs.... [INFO] Checking for unexpected pre-existing outputs. completed, took 3ms [INFO] Running build... [INFO] 1.1s elapsed, 9/10 actions completed. [INFO] 4.3s elapsed, 9/10 actions completed. [SEVERE] hive_generator:hive_generator on lib/modals/contact.dart: You have to provide a non-null typeId.
@andrewjackson1833
@andrewjackson1833 4 жыл бұрын
Getting issues with typeId, had to add typeId to the generator and remove from registerAdapter, eg: Hive.registerAdapter(ContactAdapter()); @HiveType(typeId: 0) using hive: ^1.3.0, hive_flutter^0.3.0+1, hive_generator: ^0.7.0
@verryondrums
@verryondrums 4 жыл бұрын
Thanks, ran into that as well :)!
@alexandrufilipescu1301
@alexandrufilipescu1301 3 жыл бұрын
I am not sure why I can't add a typeId:0 to registerAdapter()....
@burakbirer
@burakbirer 3 жыл бұрын
Thank you. What do you think about Hive + Firestore implementation?
@oblakus
@oblakus 4 жыл бұрын
Great tutorial 👍
@4funrc11
@4funrc11 4 жыл бұрын
WOW! Impressed... Thx!
@Toasticuss
@Toasticuss 4 жыл бұрын
Does anyone else have issues with the part file not being created after running the build runner? :( It is building successfully for me but I don't get a part file.. Edit: figured it out, the part name needs to match your file name, not the class name.
@el4040
@el4040 3 жыл бұрын
thank you
@rahulagarwal968
@rahulagarwal968 4 жыл бұрын
How can we make sure that the application doesn't load data from firestore every time it starts ? Only fetch when some changes is done in the database.
@EverisXD
@EverisXD 3 жыл бұрын
wdym firestore lmao
@MrHimanshun
@MrHimanshun 3 жыл бұрын
Great tutorial, very clear and concise. I had question though, Is there a way to implement search with hive??
@tibebeselasiemehari7503
@tibebeselasiemehari7503 4 жыл бұрын
Great content.. Thanks! One suggestion, @13:19 wouldn't returning "Center > CircularProgressIndicator" be better UX? than showing blank white screen
@ResoCoder
@ResoCoder 4 жыл бұрын
Absolutely! There goes my UX prowess, I guess 😅
@assoftpro
@assoftpro 4 жыл бұрын
Hello Ahmed from Egypt I enjoyed a lot of explanation of flutter I would like you to help me think I started creating an app to create merchant accounts I will use an internal database I would collect a column and use the sum again Do I use sqflite with flutter Or use a package from no sql database packages
@keithbacalso9433
@keithbacalso9433 2 жыл бұрын
Compact is a deep english word, it couldve been better if you shown an animation of how it works under the hood(like showing a real world example). I really did not understand seeing the `compactStrategy` and cant image how it works under the hood. However it is a good tutorial tho. I just do not get the use of the `compactStrategy`.
@aytunch
@aytunch 4 жыл бұрын
Superb. Matej, I have somewhat of an unrelated question to Hive. It occurred after you used compact() inside of dispose override. I guess compact() is a sync method. However for the sake of argument, what if it was an async method. Can we use an async call inside of dispose()? I could not find any info on SO. Thanks man.
@etiennetheodore
@etiennetheodore 4 жыл бұрын
Thanks like always.
@Baraka0369
@Baraka0369 4 жыл бұрын
Nice design dock and window btw ! What did u use ? Rainmeter ? And which package ?
@vinayp-20
@vinayp-20 4 жыл бұрын
I might be asking a dumb question. Can Hive be used as a statemanagement as well? By creating different box
@oblakus
@oblakus 4 жыл бұрын
Technically, yes. But provider is just as good, simple and optimized as it gets, so it's probably better solution
@brianmanuputty4412
@brianmanuputty4412 4 жыл бұрын
very useful, thank you
@kopianan
@kopianan 4 жыл бұрын
i got the problem for my error void main() async{ WidgetsFlutterBinding.ensureInitialized(); var appDocumentDir = await path_provider.getApplicationDocumentsDirectory(); Hive.init(appDocumentDir.path); runApp(MyApp()); } add this WidgetsFlutterBinding.ensureInitialized(); before you get the path
@LjaDj5XQKey9mSDxh4
@LjaDj5XQKey9mSDxh4 4 жыл бұрын
Does Hive.openbox('contacts') will not be called every time build() is called? The doc (api.flutter.dev/flutter/widgets/FutureBuilder-class.html) says: "If the future is created at the same time as the FutureBuilder, then every time the FutureBuilder's parent is rebuilt, the asynchronous task will be restarted."
@pradeepkumarreddykondreddy7048
@pradeepkumarreddykondreddy7048 3 жыл бұрын
Where are we defining box name as contacts ?
@nicolasdupere
@nicolasdupere 4 жыл бұрын
You are so good.
@AlexanderSiems
@AlexanderSiems 3 жыл бұрын
Just in case someone else is stuck at the same point as me where he talks about the WatchBoxBuilder. Down below in the comments is the solution which I modified a little: Widget _buildListView() { final contactsBox = Hive.box('contacts'); return ValueListenableBuilder( valueListenable: Hive.box('contacts').listenable(), builder: (context, contactsBox, _) { return ListView.builder( itemCount: contactsBox.length, itemBuilder: (context, index) { final contact = contactsBox.getAt(index) as Contact; return ListTile( title: Text(contact.name), subtitle: Text(contact.age.toString()), ); }, ); }, ); } }
@abdelrahmanabied5982
@abdelrahmanabied5982 3 жыл бұрын
new code of listview is ValueListenableBuilder( valueListenable: contacts.listenable(), builder: (context, box, child) { return ListView.builder( itemCount: contacts.length, itemBuilder: (context, index) { final contact = contacts.get(index) as Contact; return ListTile( title: Text(contact.name), subtitle: Text(contact.age.toString()), ); }); })
@rahulchowdhury279
@rahulchowdhury279 Жыл бұрын
Saved my day bro. Thanks 👍
@armagan_gok
@armagan_gok 3 жыл бұрын
where is the starter project link? please type it down I could not find it
@RNMERIA
@RNMERIA 4 жыл бұрын
I m getting 'type 'String' is not a subtype of type 'Contact' in type cast' error on this line 'final contact = contactsBox.get(index) as Contact;' Thank you
@JeremyWestAU
@JeremyWestAU 3 жыл бұрын
Did you ever manage to resolve this? I have the same issue and literally can not find a solution.
@RNMERIA
@RNMERIA 3 жыл бұрын
@@JeremyWestAU sorry cant recall it nw
@himanshudhakecha1789
@himanshudhakecha1789 3 жыл бұрын
helpful, Thanks for sharing
@marbenvillaflor6236
@marbenvillaflor6236 3 жыл бұрын
I'm having the same problem here. I'm a beginner in flutter, I'm wondering why it is still error, I already follow about what should be the remedy. If I remove the carat notation and type flutter clean, and flutter pub get or just flutter pub get, it gives me this error. Because every version of flutter_test from sdk depends on path 1.8.0-nullsafety and hive >=0.4.1 =1.6.0 =0.4.1
@yemenpoint_com
@yemenpoint_com 4 жыл бұрын
Thanks boooy your the best
@armagan_gok
@armagan_gok 3 жыл бұрын
it has been 2 years you should update codes!
@GabrielCosta-xr5vr
@GabrielCosta-xr5vr 4 жыл бұрын
Is Hive better than Sembast? Sembast has queries so I was wondering if Hive can outperform Sembast even without queries for now..
@ZEEVLOGSzubair_malik
@ZEEVLOGSzubair_malik Жыл бұрын
how i can get the same box value on other page but within same project
@PaulMcKillop
@PaulMcKillop 3 жыл бұрын
The build fails reporting that the abstract class ContactAdapter is missing implementation of members. Did I miss something?
@aminsamad6900
@aminsamad6900 2 жыл бұрын
Does it support windows? And can I back up my data and load it on another platform?
@kartikshrivastava1500
@kartikshrivastava1500 2 жыл бұрын
What is the search performance of hive? In case of millions of entries, is it suitable?
@ruslanssmolonskis9170
@ruslanssmolonskis9170 4 жыл бұрын
Hello. I have a problem to find way how to make Flutter app which uses pre-populated database with some tables. Do you have any tutorial for that?
@verryondrums
@verryondrums 4 жыл бұрын
Is there any possibility to see the data stored in the boxes?
@rairanrai992
@rairanrai992 3 жыл бұрын
anyone?
@easazade
@easazade 4 жыл бұрын
hi, what kind of database do you use for your projects? hive? moor? etc? any recommendations?
@LexPrimost
@LexPrimost 4 жыл бұрын
Hey bro, hydrated_bloc or hive for ecommerce shopping cart for unregistred users? Thank you
@ahmadfarhat1014
@ahmadfarhat1014 4 жыл бұрын
what vscode extension are you using to get tree-like parent-child , looks beautiful
@oldmen2544
@oldmen2544 3 жыл бұрын
Hey my question is do I need to ask for permission from user something like internal storage permission etc, or I can simply use it without permission as it is and in what file format it stores your data and where 🙄🙄 please help me out
@rvng6
@rvng6 3 жыл бұрын
Is it one key for one value ?? I mean lets say i want to save a user data Means everytime new user i need new key or it will be overwrite ?
@Sampelmind81
@Sampelmind81 2 жыл бұрын
Is hive able to handle millions of items, is there a limit?
@HarshSingh-hk8fe
@HarshSingh-hk8fe 3 жыл бұрын
​ @Reso Coder hi sir can i store my shopping app cart with hive ??
@kasandrop
@kasandrop 4 жыл бұрын
when you use clean architecture the entities will get polluted with these annotations. It looks terrible and at the end entities will depend on these annotations.
@pradeep422
@pradeep422 4 жыл бұрын
lol I was just thinkin f this, Reso might upload today or tommorrow about Hive...
@ResoCoder
@ResoCoder 4 жыл бұрын
I hope I didn't disappoint 😄
@Hypothermia1337
@Hypothermia1337 3 жыл бұрын
After adding items to my box and reopening the app, im getting an error: Unhandled Exception: RangeError: Not enough bytes available. I can't find a proper solution for this. Anyone know's what to do?
@MoAdel92
@MoAdel92 3 жыл бұрын
what is the vscode extension that tracing draw lines e.g between return and build?
@usefulteam
@usefulteam 4 жыл бұрын
Hi @Reso Coder, What line identation guide extension do you use (the highlighted lines of method/ properties)? E.g: Scaffold has highlighted lines for appBar and body and their childs. I've searched through vscode extensions but couldn't find it.
@scratchbfunk
@scratchbfunk 4 жыл бұрын
It's actually part of the flutter/dart extension. just add "dart.previewFlutterUiGuides": true, to your settings!
@43_arshadsaiyed78
@43_arshadsaiyed78 3 жыл бұрын
Which plugin you are using for brackets?
@radouaneelayachi4878
@radouaneelayachi4878 3 жыл бұрын
Is there anyway that you can do search in db with Hive ?? there is No Where clause !!!!
@ajinata849
@ajinata849 4 жыл бұрын
epic, this is epic.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
Is it possible for you to update this? I'm trying to get this to work with the new Flutter version etc but it seems to keep crashing..
@catalinim4227
@catalinim4227 3 жыл бұрын
spent 2h debugging the problems caused by updates.. FFS ! this is like node, nothing works as expected afer a year or so..
@lainhathoang
@lainhathoang 3 жыл бұрын
Can you give me the name of the theme u used for your vscode?
@DKSTechnology
@DKSTechnology 3 жыл бұрын
In Flutter can we create a copy of hive cluster as a backup 🙄
@officialismailshah
@officialismailshah 2 жыл бұрын
How can I add unique data in hive box
@kopianan
@kopianan 4 жыл бұрын
i got error when get path in void main(). wht should i do ?
@imransefat8770
@imransefat8770 4 жыл бұрын
WidgetsFlutterBinding.ensureInitialized(); add this at the first line in main function
@nazar.kk1
@nazar.kk1 3 жыл бұрын
May anybody tells me, why is it bad practice to expose offline data directly to the UI? 30:55 of the video
@shubhamasati4488
@shubhamasati4488 4 жыл бұрын
please use the latest packages , there are some issue with the version mentioned in this tutorial .
@gourav7315
@gourav7315 4 жыл бұрын
Please make more Hive Flutter Video
@haviforg
@haviforg 4 жыл бұрын
only local database or we can use it on server and how?
@ravichudgar
@ravichudgar 4 жыл бұрын
can we give the primary key in hive ???
@igorbondarenko9854
@igorbondarenko9854 4 жыл бұрын
Thanks for your work, what about floor?
@ResoCoder
@ResoCoder 4 жыл бұрын
I'd rather go with Moor if you want SQL.
@bjorn6017
@bjorn6017 4 жыл бұрын
are there any async methods to add or get data from hive? saving stuff on ui thread will probably freeze ui when data gets larger
@simonleier502
@simonleier502 4 жыл бұрын
Every write operation is actually async. You just don't have to await them. By default the contents of a box are cached so read operations don't access the disk. If you don't want the values to be cached, you can use "Lazy Boxes" which have async get, getAt etc.
@gokulakrishnan1977
@gokulakrishnan1977 4 жыл бұрын
Please tell me list if extension used by You.
@haberinvarsa
@haberinvarsa 2 жыл бұрын
Firebase set do hive ?
@dearvivekkumar
@dearvivekkumar 3 жыл бұрын
What path we should give for flutter web?
@varadgauthankar
@varadgauthankar 3 жыл бұрын
i guess web doesnt require a path
@rtech8779
@rtech8779 4 жыл бұрын
You are boss bro
@edhooksjr
@edhooksjr 4 жыл бұрын
Matt, Is there a TypeAdapter solution for Android Studio? (i see pubspec assist is VS Code plugin) - Manual create TypeAdapter?
@edhooksjr
@edhooksjr 4 жыл бұрын
Found it... Change #Lock file by Adding to pubspec.yaml dependency as any other package #analyzer: 0.38.2
@edhooksjr
@edhooksjr 4 жыл бұрын
TypeGen still results this>[SEVERE] hive_generator:hive_generator on lib/models/contacts.dart: Error running TypeAdapterGenerator You have to provide a non-null typeId.
@glmvnhermawan3062
@glmvnhermawan3062 4 жыл бұрын
How about angel dart ? Work's in progress? I'm really can't wait
@ResoCoder
@ResoCoder 4 жыл бұрын
Backend tutorials are heavily WIP, but I can assure you that they're coming!
@d34dsouI
@d34dsouI 4 жыл бұрын
Can Hive be used for state management? Is it an anti-pattern? What will be the disadvantages?
@Abion47
@Abion47 4 жыл бұрын
Hive is a local database package, i.e. it saves data to and reads data from a database file hosted on the device itself (and provides various convenience methods to more easily do so), and that's it. It has nothing to do with managing the state of the app, and is sort of nonsensical to ask if it does. You can use it in conjunction with a state management package for storing persistent state, but that's as far as its involvement with state management goes.
@d34dsouI
@d34dsouI 4 жыл бұрын
@@Abion47 I know what Hive is. I am asking what if we try to use it for state management. Here is the answer of the Hive author: github.com/hivedb/hive/issues/58
@simonleier502
@simonleier502 4 жыл бұрын
@@d34dsouI I was of course talking of persisting state. Don't confuse Hive with a replacement for Provider or Bloc.
@joeng7424
@joeng7424 4 жыл бұрын
Using persistent write to disk for state management is absolutely overkill, but of course you could do that anyway.
@simonleier502
@simonleier502 4 жыл бұрын
@@joeng7424 Yes of course. Hive can be used to persist for example the current position in the app. When the user comes back, he can continue right where he left. It would be a terrible idea to persist the state management.
@adriano_souza
@adriano_souza 3 жыл бұрын
How I implements this in TDD?
@luix138
@luix138 4 жыл бұрын
Sadly It seems hive isn't maintained anymore. Also, I couldn't install the dependency for incompatibility with Flutter SDK. The only way it worked was by removing flutter_test from dev_dependencies.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
I had the same problem. It helps to use dependency_overrides: dartx: ^0.4.2 ... but honestly I'm having trouble getting any Hive example thing to run properly. Overriding stuff does not make me too happy. Thinking of just trying Moor now..
@luix138
@luix138 4 жыл бұрын
@@wickedgummybear3104 in pubspec.yaml add: hive_flutter: git: url: github.com/hivedb/hive.git path: hive_flutter Because this video is a bit old and Hive was modified I had to follow the docs to see what changed docs.hivedb.dev PS: don't use Hive.initFlutter() but do use: import 'package:hive_flutter/hive_flutter.dart';
Flutter Riverpod Tutorial - The Better Provider
41:26
Reso Coder
Рет қаралды 85 М.
The Giant sleep in the town 👹🛏️🏡
00:24
Construction Site
Рет қаралды 21 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 57 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
Люблю детей 💕💕💕🥰 #aminkavitaminka #aminokka #miminka #дети
00:24
Аминка Витаминка
Рет қаралды 581 М.
Riverpod 2.0 - Complete Guide (Flutter Tutorial)
1:03:37
Reso Coder
Рет қаралды 109 М.
Using Firestore as a backend to your Flutter app
11:42
Google for Developers
Рет қаралды 524 М.
Top 12 Flutter Tips & Tricks
9:32
Fireship
Рет қаралды 268 М.
Practical Functional Programming in Dart & Flutter
37:12
Reso Coder
Рет қаралды 14 М.
Top 35 Flutter Widgets
29:29
Flutter Mapp
Рет қаралды 323 М.
Hive database flutter tutorial, CRUD
26:33
Easy Approach
Рет қаралды 28 М.
Create Responsive Flutter Apps with Minimal Effort
43:10
Reso Coder
Рет қаралды 74 М.
The Giant sleep in the town 👹🛏️🏡
00:24
Construction Site
Рет қаралды 21 МЛН