Hive: Is there a way to list exiting boxes and check if a certain box exists?

Created on 14 Jul 2020  路  3Comments  路  Source: hivedb/hive

Didn't find api for:

  1. Getting list of existing/not empty Hive boxes
  2. Checking by box name if it has bern created before (and/or is not empty)

Are there any options? Thanks

question

Most helpful comment

  1. Getting list of existing/not empty Hive boxes

I think this feature have not yet implemented into hivedb.

  1. Checking by box name if it has bern created before (and/or is not empty)

Did you tried using .boxExists method for checking exists boxes?

bool exists = await Hive.boxExists('boxName');

All 3 comments

  1. Getting list of existing/not empty Hive boxes

I think this feature have not yet implemented into hivedb.

  1. Checking by box name if it has bern created before (and/or is not empty)

Did you tried using .boxExists method for checking exists boxes?

bool exists = await Hive.boxExists('boxName');

Thanks. It seems the way to check for existing boxes is to list *.hive files in app's direcotry (they are named after boxes' names).
P.S.: the use case for listing existing boxes is to keep track of potential grabage and clean it

Thanks. It seems the way to check for existing boxes is to list *.hive files in app's direcotry (they are named after boxes' names).
P.S.: the use case for listing existing boxes is to keep track of potential grabage and clean it

Yes you can list exists boxes by listing *.hive files. This was not implemented in hive because user may store hive files in any directory not just app's data dir. Also hive uses different storage method on web. So this will not work on web.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sergiyvergun picture sergiyvergun  路  4Comments

cachapa picture cachapa  路  4Comments

yaymalaga picture yaymalaga  路  4Comments

rupamking1 picture rupamking1  路  3Comments

joaovbalmeida picture joaovbalmeida  路  4Comments