Skip to content

rohankandwal/Flutter-Clean-Architecture-Demo-w-Realtime-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Clean Architecture w/ BLoC, Get_It & Hive

App to showcase demo for how to have Clean Architecture in Flutter with Get_It for dependency injection, BLoC for state maintainence and Hive for persisting data into database.

Getting Started

This project is to showcase how we can use Clean Architure in Flutter App. The architecture of the app is as follows -

Clean Architecture design

The existing folder structure of the project is as belows -

image

Stream<List<FeedModel>> getFeedPostsDatabaseStream() {
  if (_feedBox == null) {
    _initializeHiveBox();
  }
  return _feedBox!.watch().map((event) => List<FeedModel>.generate(
      _feedBox!.values.length, (index) => _feedBox!.getAt(index)!));
}

Above function will create a Stream to listen for all the changes in the database. This then can be used to update the values automatically on feed_screen.dart.

Run Project

flutter pub get

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

Then you can run the project as usual

About

Flutter Clean Architecture using BLoC, Get_It, & Hive Db

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published