Hive Wait provide a Hive repository to calling methods in the box as async.

Overview

Hive Wait

Hive Wait provide a Hive repository to calling methods in the box as async.

Wait until the Hive is ready to use before calling the box's methods.

Usage

  • Wait init Hive
class CoreRepository<E> extends HiveRepository<E> {
  CoreRepository(
    String name, {
    bool? lazy,
    HiveCipher? encryptionCipher,
    KeyComparator? keyComparator,
    CompactionStrategy? compactionStrategy,
    bool? crashRecovery,
    String? boxPath,
    Uint8List? bytes,
  }) : super(
          name,
          lazy: lazy,
          encryptionCipher: encryptionCipher,
          keyComparator: keyComparator,
          compactionStrategy: compactionStrategy,
          crashRecovery: crashRecovery,
          boxPath: boxPath,
          bytes: bytes,
        );

  @override
  Future<BoxBase<E>> init([HiveInterface? hive]) async {
    await Hive.initFlutter();
    // TODO: Register adapter
    return await super.init(Hive);
  }
}
  • Using with get_it
class CoreRepository<E> extends HiveRepository<E> {
  CoreRepository(
    String name, {
    bool? lazy,
  }) : super(name, lazy: lazy);

  @override
  Future<BoxBase<E>> init([HiveInterface? hive]) async {
    await getIt.allReady();
    hive = await getIt.getAsync<HiveInterface>();
    return await super.init(hive);
  }
}

// TODO: register a singleton with get_it
class PropertyRepository extends CoreRepository<Property> {
  PropertyRepository() : super('property');
}
  • Get data
getUser() async {
  var userRepository = CoreRepository<User>('user');
  return await userRepository.get(0);
}
You might also like...

Dart and Flutter sealed class generator and annotations, with match methods and other utilities. There is also super_enum compatible API.

Dart Sealed Class Generator Generate sealed class hierarchy for Dart and Flutter. Features Generate sealed class with abstract super type and data sub

Jan 2, 2023

Superpowers for Dart. Collection of useful static extension methods.

If you miss an extension, please open an issue or pull request Resources: Documentation Pub Package GitHub Repository On this page you can find some o

Jan 8, 2023

Learn how to use Dart List Utility Methods in Flutter

Learn how to use Dart List Utility Methods in Flutter

Flutter Tutorial - List Utility Methods Learn how to use Dart List Utility Metho

Dec 29, 2021

The easiest way to use navigation, context less and useful methods.

The easiest way to use navigation, context less and useful methods.

Starlight Utils The easiest way to use navigation, context less and useful methods. Features Name Status Context Less Navigation Service ✅ Context Les

Jul 10, 2022

A dart package for many helper methods fitting common situations

Basic Utils A dart package for many helper methods fitting different situations. Table of Contents Basic Utils Table of Contents Preamble Install pubs

Jan 5, 2023

The Integration Test Helper has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage.

The Integration Test Helper has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage.

The Integration Test Helper has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage (using Android and iOS

Apr 7, 2022

Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc.

ruqe Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc. Additionally, the librar

Dec 28, 2022

This is a Flutter app which shows how to add a Fitted Box in you App

fittedbox A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Oct 25, 2021

A custom bottom navigation bar with box animation for flutter

A custom bottom navigation bar with box animation for flutter

A custom bottom navigation bar with box animation. This is inspired from some of the earlier designs, but in a more simplified and yet exiting way. De

Jul 31, 2022
⚡FQuery is a powerful async state management solution for flutter. It caches, updates and fully manages asynchronous data in your flutter apps.

⚡ FQuery is a powerful async state management solution for flutter. It caches, updates and fully manages asynchronous data in your flutter apps. It ca

Piyush 21 Dec 22, 2022
A Dart utility package for easy async task cancellation

Dart Cancellation Token. Inspired by CancellationToken in C#. A Dart utility package for easy async task cancellation.

Petrus Nguyễn Thái Học 4 Sep 6, 2022
Dart package for Async Data Loading and Caching. Combine local (DB, cache) and network data simply and safely.

Stock is a dart package for loading data from both remote and local sources. It is inspired by the Store Kotlin library.

xmartlabs 59 Dec 24, 2022
Local data hive - Local data hive for flutter

local_data_hive A new Flutter application. ScreenShot

Mehmet Emre ÖZ 0 Jan 8, 2022
Flutter plugin to simply integrate Agora Video Calling or Live Video Streaming to your app with just a few lines of code.

Agora UI Kit for Flutter Instantly integrate Agora video calling or video streaming into your Flutter application. Getting started Requirements An Ago

Agora.io Community 106 Dec 16, 2022
Api Call Check flutter - A new Flutter project that demonstrates api calling and displays them in a scrollable list

api_fetch A new Flutter project that demonstrates api calling and displays them

Babish Shrestha 0 Jan 2, 2022
A new video calling mobile application using Flutter, Agora SDK and GetX state management.

LiveBox : A Video Calling App A new video calling mobile application using Flutter, Agora SDK and GetX state management. Features Login Registration F

Nikhil Rajput 14 Dec 3, 2022
This repository was created to provide the basics of the Dart programming language and Its use cases.

dart-exercises A collection of source code of the Dart Programming language. How does this repository works? Clone / Fork this repository to make your

Technosoft Labs 2 Oct 28, 2021
JSON formatted API Get, Patch, Put, Post, Delete methods implemented as a dummy.

json_api_handle A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Md. Sabik Alam Rahat 4 Nov 13, 2022