Hive database with type adapter in Flutter Todo Application

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 72

  • @ajaykotiyal427
    @ajaykotiyal427 4 роки тому +2

    Thanks for the video. Your voice is very clear.
    Usually men's voice is heavy (I think because of low frequency), so not cleared to understand.

    • @EasyApproach
      @EasyApproach  4 роки тому

      hahhaha! You mean I have girlish voice :D?

    • @ajaykotiyal427
      @ajaykotiyal427 4 роки тому +1

      @@EasyApproach No. I didn't mean so. :D
      But better in men's category, specially as a teacher. so that students can understand easily. At least no issue with voice.

    • @EasyApproach
      @EasyApproach  4 роки тому

      Haha ok just jocking!

  • @shahzadasalman8461
    @shahzadasalman8461 4 роки тому +5

    Really appreciate your work man.

  • @АлександрИванов-ю8с8г

    Very COOL! Flutter & Firebase Functions will be grate!

  • @mahmudurrahmanshovon185
    @mahmudurrahmanshovon185 4 роки тому +2

    The most awaited video for me. And you did great again. Thanks a lot bro. 💚💚💚

  • @adimardev1550
    @adimardev1550 Рік тому

    i had to admit, that was a great intro.

  • @Cajaba100
    @Cajaba100 4 роки тому +1

    I am from Brazil, thanks this is helped me.

    • @EasyApproach
      @EasyApproach  4 роки тому

      Thank you. Please subscribe the channel.

  • @ahmedmohamed2938
    @ahmedmohamed2938 4 роки тому +1

    Thanks Alot, great work and easy explanation

  • @SHAFIulBARI
    @SHAFIulBARI 4 роки тому +4

    thank you brother, it helped me a lot.

    • @EasyApproach
      @EasyApproach  4 роки тому

      Thanks. Please subscribe the channel

  • @emwagner
    @emwagner 11 місяців тому

    If I'm understanding correctly, the enum for incomplete is now not being used. Because you're negating the iscomplete enum instead of specifying the enum in the else block..

  • @sydneybecher4733
    @sydneybecher4733 4 роки тому +2

    Please help! I got this error 'the method 'listenable' isn't defined for the type 'Box'' when trying to get value from the box. Thanks

    • @EasyApproach
      @EasyApproach  4 роки тому +2

      You need to import flutter_hive.dart in the file you are using listenable

    • @EasyApproach
      @EasyApproach  4 роки тому

      Thank you. Please subscribe the channel.

    • @RudeboyJackson
      @RudeboyJackson 4 роки тому

      Thank you!

  • @PriyanshuRaj-oc4tk
    @PriyanshuRaj-oc4tk 4 роки тому +1

    Hi Maaz! Very nice explanation! But I wanted to clear a doubt I am having about type adapters. In this video you used only one model class. If there are more than one model class (i.e. more than one type adapters) and there are more than one boxes of HIVE, then what is the proper way of registering these type adapters to different boxes in HIVE?

    • @muhammadtaha7531
      @muhammadtaha7531 3 роки тому

      You can use as much adapters as you want;
      Future main() async {
      Hive.registerAdapter(AAdapter());
      Hive.registerAdapter(BAdapter());
      Hive.registerAdapter(CAdapter());
      ...
      ...
      Hive.registerAdapter(nAdapter());
      await Hive.initFlutter();
      await Hive.openBox('boxA');
      await Hive.openBox('boxB');
      await Hive.openBox('boxC');
      ...
      ...
      await Hive.openBox('boxn');
      runApp(MyApp());
      }

  • @ebk_72
    @ebk_72 3 роки тому +1

    Hi. Thankyou for this amazing tutorial!
    I do have a question though. What if I have another model class I need to save within the fields of my Hive Box? So for example,
    I have a class *Cart*
    which will have the fields: *String* customerName ; *Integer* customerId ; *List* items
    And another class *Item*
    which will have the fields: *Integer* productId ; *String* productName ; *Integer* quantity
    I could make two TypeAdapters for the model classes but how can I store the Item class inside the Cart Box? Since Hive only stores primitive data types.

    • @LuminousAsianBeauties
      @LuminousAsianBeauties 3 роки тому +2

      I tried and sucessfully made it.
      first, you create 2 file for each model ( @HiveType(typeId: 0) for item_model.dart and @HiveType(typeId: 1) for cart_model.dart)
      then generate 2 files.
      then init 2 adapter in void main()
      after,
      floatingActionButton: FloatingActionButton(
      onPressed: () {
      ItemModel item1 =
      ItemModel(productId: 5, productName: "Water", quantity: 5);
      ItemModel item2 =
      ItemModel(productId: 2, productName: "Bread", quantity: 12);
      List itemList = [item1, item2];
      CartModel cart = CartModel(
      customerName: "Hieu Le", customerId: 1, items: itemList);
      cartBox.add(cart);
      then for display on UI:
      body: ValueListenableBuilder(
      valueListenable: cartBox.listenable(),
      builder: (context, Box carts, _) {
      List keys = carts.keys.cast().toList();
      return ListView.separated(
      itemBuilder: (context, index) {
      final int key = keys[index];
      CartModel? cart = carts.get(key);
      ItemModel? item = cart!.items[1];
      return ListTile(
      title: Text(
      cart.customerName,
      style: const TextStyle(
      fontWeight: FontWeight.bold, fontSize: 15),
      ),
      subtitle: Text(item.productName + item.quantity.toString()),
      );
      },
      separatorBuilder: (context, index) => const Divider(),
      itemCount: carts.keys.toList().length);
      },
      ),
      hope it helps you.

    • @ebk_72
      @ebk_72 3 роки тому

      @@LuminousAsianBeauties Thanks. I will try it out :)

  • @pythonantole9892
    @pythonantole9892 4 роки тому +4

    Small request. Can you update the Flutter playlist with the latest videos.

    • @EasyApproach
      @EasyApproach  4 роки тому +1

      Sure. Thank you for suggestion 😊

  • @arremayu
    @arremayu 4 роки тому +3

    if anyone got error at typeId just change hive dependency to 1.2.0 without ^ carrot

    • @EasyApproach
      @EasyApproach  4 роки тому +2

      Thanks

    • @arremayu
      @arremayu 4 роки тому +1

      @@EasyApproach dude can you make video how can we backup this hive data on cloud like firebase or our own cloud??? btw your teaching is so simple and understandable thank you!!

  • @manjukeyal4744
    @manjukeyal4744 4 роки тому +1

    Flutter build runner not working properly i yry deleaying conflicted files its not genrating anything running uptodate on stable channel how can i write adapter class manually

    • @EasyApproach
      @EasyApproach  4 роки тому

      May be you didn't include g.dart file. Double check it

  • @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

  • @codeaxen
    @codeaxen 2 роки тому

    this is not working with tabs when i swipe tabs i get error : forgot to open box and box already opened

  • @loncatsanasini6159
    @loncatsanasini6159 4 роки тому +1

    great tutorial, thanks

    • @EasyApproach
      @EasyApproach  4 роки тому

      Thank you. Please subscribe the channel.

  • @henrypowell3496
    @henrypowell3496 3 роки тому +1

    hey bro it's showing the generation process in the terminal but the file is not generating and i have part g.dart line too any help?

    • @EasyApproach
      @EasyApproach  3 роки тому

      Can you show me the console

    • @king4053
      @king4053 3 роки тому

      it has to be the same name then append ".g.dart " at the end

    • @henrypowell3496
      @henrypowell3496 3 роки тому

      @@king4053 thnx it worked...can I ask you again if I get in any trouble here?

    • @king4053
      @king4053 3 роки тому

      I just recently started using this too. I may not be that much of a help but I'll answer if I know.

  • @rommyarb
    @rommyarb 4 роки тому +1

    Why not using todo.save() method instead of box.put() ?

  • @sedatgulmen.developer
    @sedatgulmen.developer 3 роки тому

    thanks. this is very good..

  • @sarang_vs
    @sarang_vs 3 роки тому

    the data is not storing inside the app after closing and reopening it

  • @thomasblackwood5498
    @thomasblackwood5498 3 роки тому

    *"Unhandled Exception: HiveError: Cannot write, unknown type: ItemModel. Did you forget to register an adapter?"* But I already registered the adapter. What's going on????

  • @Cajaba100
    @Cajaba100 4 роки тому +1

    does each box represent a table? right?

  • @mdakramkhan7285
    @mdakramkhan7285 4 роки тому +2

    Thanks a lot.

    • @EasyApproach
      @EasyApproach  4 роки тому +1

      Welcome. Please subscribe the channel.

  • @ajeethrajas7282
    @ajeethrajas7282 4 роки тому

    After generating type adapter it show error in generated file "missing concrete implement of 'getter TypeAdapter.typeid' "

    • @EasyApproach
      @EasyApproach  4 роки тому +1

      Before every type you must specify type id

  • @domontowicz
    @domontowicz 3 роки тому

    pub finished with exit code 1. Changing versions of sdk or hive didn't help

    • @EasyApproach
      @EasyApproach  3 роки тому

      Can you tell me what is written over there in error?

  • @BrYarDJ
    @BrYarDJ 4 роки тому +2

    hello you can create tutorial for creating mysql database offline in local project in app?

    • @EasyApproach
      @EasyApproach  4 роки тому +2

      Sure

    • @B21-q8k
      @B21-q8k 4 роки тому

      ​@@EasyApproach Nice, can sql use hive?

    • @vixen5861
      @vixen5861 4 роки тому

      @@B21-q8k While storing data locally in a Flutter app, You can use either Hive or sqflite or SharedPreferences. It mostly does the same thing but there are different perks to each package.

  • @abderaoufcherafa8387
    @abderaoufcherafa8387 4 роки тому +1

    How can we edit the note or delete it! And thank u

    • @EasyApproach
      @EasyApproach  4 роки тому +1

      We have delete function in the box for deleting and for editing you need to overwrite data on the existing id.

  • @ekempinger
    @ekempinger 4 роки тому +1

    funny start;-)

    • @EasyApproach
      @EasyApproach  4 роки тому

      hehe! Please subscribe the channel!

  • @shahriarmomen
    @shahriarmomen 2 роки тому

    Please sir make a tutorial how to edit the tast list

  • @flexydevs
    @flexydevs 3 роки тому

    todo todo todo tdooooooooooooooodoooooooooooodoooooooooooo

  • @ezone2726
    @ezone2726 3 роки тому +1

    Thank you for this awsome tutorial and i had try to delete the hive data but it wont work.
    Try this code👇
    Inside onpressed(){
    final key = _title.text;
    todoBox.delete(key);
    Navigator.pop(context)
    }
    Is anything wrong there please help me out!
    Again thank you and stay healthy.

  • @void4904
    @void4904 3 роки тому

    3:23 6:49

  • @hk20092009able
    @hk20092009able 3 роки тому +1

    To much complicated

  • @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