iniakunhuda / flutter_riverpod_strapi

Simple CRUD Riverpod Flutter + Strapi API + Offline Database with Isar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flutter Riverpod Strapi

GitHub stars GitHub forks GitHub watchers

GitHub license platform Open Source Love

Quick start

This is a normal flutter app. You should follow the instructions in the official documentation. This project uses Riverpod to separate the business logic with UI itself. And also on this project uses Clean Architecture approach to separate each feature.

Structure πŸ”₯

β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ core
β”‚   β”‚   β”œβ”€β”€ api
β”‚   β”‚   β”‚   └── endpoints.dart
β”‚   β”‚   β”œβ”€β”€ constant
β”‚   β”‚   β”‚   └── constant.dart
β”‚   β”‚   β”œβ”€β”€ database
β”‚   β”‚   β”‚   └── database.dart
β”‚   β”‚   β”œβ”€β”€ helper
β”‚   β”‚   β”‚   β”œβ”€β”€ app_exception.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ app_router.dart
β”‚   β”‚   β”‚   └── network_detector.dart
β”‚   β”‚   └── http
β”‚   β”‚       β”œβ”€β”€ api_provider.dart
β”‚   β”‚       └── api_response.dart
β”‚   β”œβ”€β”€ features
β”‚   β”‚   β”œβ”€β”€ contact
β”‚   β”‚   β”‚   β”œβ”€β”€ data
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ database
β”‚   β”‚   β”‚   β”‚   β”‚   └── contact_db.dart
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ datasource
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ contact_datasource.dart
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ contact_local_datasource.dart
β”‚   β”‚   β”‚   β”‚   β”‚   └── contact_remote_datasource.dart
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dto
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ contact_dto.dart
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ error_dto.dart
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ model
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ contact_model.dart
β”‚   β”‚   β”‚   β”‚   └── state
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ contact_state.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ domain
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ provider
β”‚   β”‚   β”‚   β”‚   β”‚   └── contact_provider.dart
β”‚   β”‚   β”‚   β”‚   └── repository
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ contact_repository_impl.dart
β”‚   β”‚   β”‚   β”‚       └── contact_repository.dart
β”‚   β”‚   β”‚   └── presentation
β”‚   β”‚   β”‚       β”œβ”€β”€ screen
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ create_screen.dart
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ detail_screen.dart
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ edit_screen.dart
β”‚   β”‚   β”‚       β”‚   └── list_screen.dart
β”‚   β”‚   β”‚       └── widget

Features

  • Add, Edit and Remove Contact
  • Rest API from Strapi
  • Offline database
  • Script manager with derry
  • Clean Architecture

Banner Design

feed example feed example feed example feed example

Built With πŸ› 

  • Clean Architecture - The blueprint for a modular system, which strictly follows the design principle called separation of concerns.
  • Dartz - Functional Programming in Dart
  • Derry - A script manager to help you define script shortcuts and use them effortlessly
  • Dio - A type-safe HTTP client.
  • Freezed - Code generation for immutable classes
  • Go Router - Route management Flutter
  • Isar Database - Local Database
  • Riverpod - State management with upgrade from provider
  • Strapi API - Handle rest api from Headless CMS
  • Handle State - (Loading, No Data, Has Data, Error)

Author

  • Miftahul Huda

Don't forget to follow me, fork and give me a ⭐

How to run app

Install package

flutter pub get

Run in terminal to generate freezed file

derry build

Copy .env.example to .env and fill credential from Strapi

// assets/.env

API_KEY_STRAPI=xxx
API_BASE_URL=xxx

Strapi Setup

Install Strapi in your local computer

Run project

npm start

Create collection structure like this

feed example

About

Simple CRUD Riverpod Flutter + Strapi API + Offline Database with Isar

License:MIT License


Languages

Language:Dart 100.0%