Skip to content

marcus-exe/hive_app

Repository files navigation

Hive + Riverpod CRUD with Localization 🌍

A simple Flutter app demonstrating persistent CRUD operations using Hive for local storage and Riverpod for state management. This updated version includes full support for localization and internationalization (i18n), as well as database encryption.


Features

  • Multi-language support with localization.
  • Encrypted persistent storage using Hive.
  • Add, edit, and delete todos.
  • Reactive UI using Riverpod.
  • Clean project structure with distinct layers for models, repositories, providers, and pages.

Localization

This app is localized for the following languages:

  • 🇬🇧 English (en)
  • 🇪🇸 Spanish (es)
  • 🇧🇷 Brazilian Portuguese (pt)

The localization is managed using the official flutter_gen and intl packages, storing strings in .arb (Application Resource Bundle) files.


Folder Structure 📁

lib/
├── l10n/
│   ├── intl_en.arb
│   ├── intl_es.arb
│   └── intl_pt.arb
├── main.dart
├── models/
│   ├── todo.dart
│   └── todo.g.dart
├── repositories/
│   └── todo_repository.dart
├── providers/
│   └── todo_provider.dart
└── pages/
    ├── home_page.dart
    └── todo_form_page.dart
  • l10n/ → Contains localization resource files.
  • models/ → Hive data models.
  • repositories/ → Handles data operations (CRUD).
  • providers/ → State management with Riverpod.
  • pages/ → UI pages.

Getting Started 🚀

1. Prerequisites

  • Flutter SDK installed
  • Dart SDK installed
  • Android Studio or VS Code with Flutter extension

2. Clone the repository

git clone https://github.com/marcus-exe/hive_app.git
cd hive_app

3. Install dependencies

flutter pub get

4. Run Code Generation

flutter pub run build_runner build --delete-conflicting-outputs
flutter gen-l10n

Note: These commands generate the necessary todo.g.dart file for Hive and the localization files for translations. The encryption key will be generated and stored securely on the first launch of the app.

5. Run the app

flutter run

Packages Used 📦


Usage

  1. Tap the + button to add a new todo.
  2. Tap on a todo to edit.
  3. Tap the trash icon to delete.
  4. The app's language will change automatically based on your device's language settings.

Project Architecture 🏛️

  • Clean Architecture:

    • Models → Data representation.
    • Repositories → Handles Hive operations.
    • Providers → Manages app state (Riverpod).
    • Pages → UI components.
  • Benefits:

    • Clear separation of concerns.
    • Easy to maintain and extend with new features.
    • Reactive UI updates.

Screenshots 📸

Home Add List

Future Improvements 💡

  • Add search/filter functionality.
  • Integrate with a remote backend.
  • Implement authentication.
  • Add unit and widget tests.

License

This project is open-source and available under the MIT License.

About

flutter crud nosql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published